476c28084e
repeat#set() so far automatically incremented b:changedtick. Problems with this: 1. The way that was done clobbered the expression register "=. 2. It causes the "readonly" warning and "Cannot make changes" error in readonly/nomodifiable buffers, so mappings that don't modify anything cannot be repeated there. 3. It's actually not needed most of the time, because many user mappings and all repeatable Vim built-in normal mode commands I know (with the exception of yank with cpo+=y) actually do modify the buffer themselves. For the exceptional case where the user has a set of related mappings, one that repeats naturally (e.g. a custom operator, via g@), and one that invokes repeat#set(), and both do not modify the buffer, a new function repeat#invalidate() is offered. This should be called by the former mapping, and all is well. |
||
---|---|---|
autoload | ||
README.markdown |
repeat.vim
If you've ever tried using the .
command after a plugin map, you were
likely disappointed to discover it only repeated the last native command
inside that map, rather than the map as a whole. That disappointment
ends today. Repeat.vim remaps .
in a way that plugins can tap into
it.
The following plugins support repeat.vim:
Adding support to a plugin is generally as simple as the following command at the end of your map functions.
silent! call repeat#set("\<Plug>MyWonderfulMap", v:count)
Installation
If you don't have a preferred installation method, I recommend installing pathogen.vim, and then simply copy and paste:
cd ~/.vim/bundle
git clone git://github.com/tpope/vim-repeat.git
Contributing
See the contribution guidelines for pathogen.vim.
Self-Promotion
Like repeat.vim? Follow the repository on GitHub and vote for it on vim.org. And if you're feeling especially charitable, follow tpope on Twitter and GitHub.
License
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
See :help license
.