In Neovim, the .
character repeats "the most recent action"; however, this is not always respected by plugin actions. Here we will explore how to build dot-repeat support directly into your plugin, bypassing the requirement of dependencies like repeat.vim.
When some buffer-modifying action is performed, Neovim implicitly remembers the operator (e.g. d
), motion (e.g. iw
), and some other miscellaneous information. When the dot-repeat command is called, Neovim repeats that operator-motion combination. For example, if we type ci"text<Esc>
, then we replace the inner contents of some double quotes with text
, i.e. "hello world"
→ "text"
. Dot-repeating from here will do the same, i.e. "more samples"
→ "text"
.