How do I make plugin commands repeatable with the dot command?
Answer
Plug 'tpope/vim-repeat'
Explanation
vim-repeat by Tim Pope extends the . (dot) command to work with plugin mappings. Without it, . only repeats built-in Vim commands.
How it works
- Install the plugin
- Plugin authors call
repeat#set()in their mappings - Now
.repeats the last plugin command
Example
With vim-surround and vim-repeat installed:
ysiw"wraps a word in quotes- Move to another word
.wraps that word in quotes too
Without vim-repeat, . would not repeat the surround command.
Tips
- Install:
Plug 'tpope/vim-repeat' - Works with vim-surround, vim-commentary, vim-unimpaired, and more
- No configuration needed — it works automatically
- Plugin authors must support it for their commands to be repeatable
- It is a tiny plugin with zero overhead