Vimmers know that .
can repeat simple changes. I tried to build a list of what can be repeated or not, but is there a list?
I tried to list what I know
I believe a change is any command that modifies the current buffer. The .
command excludes Ex commands (because that's a different mode that was bolted onto vi in the far history, I guess), and can optionally include yanks.
So for your list, :help change.txt
, filtered for Ex commands, is probably the best source.
Note that when a change command cannot be applied (i.e. it beeps), it is also not registered for repeat; the command execution must be successful.
some combination with v/V can be "dot" repeated too.
e.g.
Vgq, v/VU or v/Vu
Tim Pope's repeat.vim
can make repeat
many more things (including stuff like surround.vim
and other must haves).
To repeat a motion, look at , / ; (forward/reverse direction).
To repeat an Ex command, @: is a good key combination
Example: If you want to sort following inline lists of numbers,
first 3,2,17,198,232,1,999 and some other text
second 1,2,3,71,98,4,5 and some more text
consider these two ways using the expression register:
ciW
and then <C-r>=join(sort([<C-r>"]), ',')<CR>
ciW
and then <C-r>=join(sort(split(expand(@"), ',')), ',')<CR>
If you try to repeat either of them for the second line with .
, vim simply enters again the same list from the first line.
This might be expected by others but I was hoping that for the second way the expression register would be re-evaluated.