Giter VIP home page Giter VIP logo

Comments (6)

chaoren avatar chaoren commented on September 16, 2024

This plugin doesn't touch W, B, E, or gE by default, so you don't have to worry about those.

let g:wordmotion_mappings = {
    'w' : '<M-w>',
    'b' : '<M-b>',
    'e' : '<M-e>',
    'ge' : 'g<M-e>',
    'aw' : 'a<M-w>',
    'iw' : 'i<M-w>'
}

should do what you want.

from vim-wordmotion.

kshenoy avatar kshenoy commented on September 16, 2024

Instead of using consider using <Plug>s. It's more portable and also allows for some fancy things like allowing lazy loading by plugin managers.

Thanks for a great plugin :)

from vim-wordmotion.

chaoren avatar chaoren commented on September 16, 2024

Instead of using consider using <Plug>s.

Instead of using what?

from vim-wordmotion.

kshenoy avatar kshenoy commented on September 16, 2024

Whoops, I meant "instead of using a dictionary to specify maps". The advantage is if someone uses a plugin manager which allows lazy loading, they can do something like this.

This will cause the plugin to be loaded only when the maps are actually used.

from vim-wordmotion.

chaoren avatar chaoren commented on September 16, 2024

It's more portable

It's all vimscript, how is any one construct more portable than another? Unless you mean if some old vim version doesn't support dictionaries, but does support <Plug>. I don't think that's the case, and honestly don't care even if it is.

The advantage is if someone uses a plugin manager which allows lazy loading

You can do this:

let g:wordmotion_mappings = {
    'w' : '<Plug>WordmotionW',
    'b' : '<Plug>WordmotionB',
    ...
}
map <M-w> <Plug>WordmotionW
map <M-b> <Plug>WordmotionB
...

I know what the other plugin does. I personally think that's extremely ugly, and option variables with the form g:<plugin name>_<option name> are much cleaner and easier to keep track of. This workaround I just gave you is also extremely ugly, but you're free to do whatever you want.

Another thing is that lazy loading for tiny plugins like these is really unnecessary, but if you're that serious about saving 10 nanoseconds of load time, then go for it. This is also why I didn't use autoloading at all. It's so pointless for a plugin of this size.

from vim-wordmotion.

kshenoy avatar kshenoy commented on September 16, 2024

This is also why I didn't use autoloading at all. It's so pointless for a plugin of this size.

That is a good point; I didn't consider that in my haste to lazy load every plugin that I could.

Thanks for your help.

from vim-wordmotion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.