So my mental model of commands in vi is that “nC” is the same as executing “C” n times.
Right; this is wrong. ‘nC’ argues the number ‘n’ to the command ‘C’. To give another example, 3<< won’t dedent the current line by three levels; it will dedent three lines by one level each.
5J argues 5 to the J command, which in response joins 5 lines together.
If you want to join the following 5 lines with the current one, one solution is V5jJ.
Yeah arguments are weird. If I wanted to join the following 5 lines, I’d do it with :,+5j. Bit longer than V5jJ but command-join is more flexible in general
So my mental model of commands in vi is that “nC” is the same as executing “C” n times.
There are other commands that invalidate this model: 3dd, when positioned on the second line of a buffer with three lines, deletes only two of them; dddddd deletes all three.
What is odd is that 3dd does nothing at all when positioned on the last line. This appears to be a long-standing issue in Vim (present all the way back to 1991, as far as I can see) and also in Neovim, but not in Evil.
Right; this is wrong. ‘nC’ argues the number ‘n’ to the command ‘C’. To give another example,
3<<
won’t dedent the current line by three levels; it will dedent three lines by one level each.5J
argues5
to theJ
command, which in response joins 5 lines together.If you want to join the following 5 lines with the current one, one solution is
V5jJ
.Yeah arguments are weird. If I wanted to join the following 5 lines, I’d do it with
:,+5j
. Bit longer thanV5jJ
but command-join is more flexible in generalThere are other commands that invalidate this model:
3dd
, when positioned on the second line of a buffer with three lines, deletes only two of them;dddddd
deletes all three.What is odd is that
3dd
does nothing at all when positioned on the last line. This appears to be a long-standing issue in Vim (present all the way back to 1991, as far as I can see) and also in Neovim, but not in Evil.