tpope / vim-repeat

repeat.vim: enable repeating supported plugin maps with "."
http://www.vim.org/scripts/script.php?script_id=2136
2.58k stars 81 forks source link

Doesn't work well with vim-plug #70

Closed infokiller closed 5 years ago

infokiller commented 5 years ago

This plugin isn't loaded by vim-plug, seemingly because vim-plug doesn't load files from an autoload directory- it looks for one of ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'].

I'm not really familiar with the required directory structure of vim plugins so can't really say what's the correct way.

infokiller commented 5 years ago

After some digging (and reading on autoload), seems that the issue is that the way I use the plugin is by a mapping such as nmap <C-r> <plug>(RepeatRedo), but that does not trigger the autoload mechanism, which IIUC will only trigger when the filename#funcname call is made.

Other than putting this file in a plugin dir (which means I won't use it with vim-plug), is there anything I can do so that the plugin is loaded properly?

Thanks

tpope commented 5 years ago

The idea is that it's lazily loaded by the first call to repeat#set(). Before that, there's no need for the maps to exist.

infokiller commented 5 years ago

Can you please clarify? Do you mean I'm expected to call repeat#set() explicitly after vim is opened?

tpope commented 5 years ago

No, the load is triggered by a plugin calling repeat#set(). If you don't have any plugins that do that, then repeat.vim never gets loaded, and that's as intended.

infokiller commented 5 years ago

Got it, thanks for the explanation!