tpope/vim-repeat

please add a concrete example

jabbalaci opened this issue · 2 comments

By reading the README it was not clear to me how to use this plugin. Using this screencast (http://vimcasts.org/episodes/creating-repeatable-mappings-with-repeat-vim/) I managed to figure out how it works. Here is a concrete example, I think it would be a good idea to add it (or something similar) to the README:

before

nnoremap <Leader>' viw<esc>a'<esc>hbi'<esc>lel

It surrounds the current word (manual solution).

after

nnoremap <silent> <Plug>SurroundWordWithApostrophe  viw<esc>a'<esc>hbi'<esc>lel
    \ :call repeat#set("\<Plug>SurroundWordWithApostrophe", v:count)<cr>
nmap <Leader>'  <Plug>SurroundWordWithApostrophe

Now it's repeatable with the "." command.

I agree with jabbalaci. It's not at all clear how to use this plugin. I thought you could execute a plugin command, move to another position in your file, hit ".", and the command would repeat itself. Clearly that's not the case as you still need to create a custom mapping for this to work.