25
5
In Vim, with .
, I can repeat the last normal mode command; for example:
dd.
deletes a line twice.
But, if I type
5j.
the cursor does't move 10 lines down. How do I repeat the last normal mode command, especially a move?
25
5
In Vim, with .
, I can repeat the last normal mode command; for example:
dd.
deletes a line twice.
But, if I type
5j.
the cursor does't move 10 lines down. How do I repeat the last normal mode command, especially a move?
14
vim
doesn't do this unfortunately. The best you can do is install the repmo.vim plugin, which repeats movement commands that have a count.
12
it's doable even in vanilla vim, but applicability depends on your use case, ie. how often you'll need to repeat it, since it requires few more keystrokes to make it repeatable.
using moving down 5 lines as example, you can do:
:norm 5j
, it'll move the cursor down 5 lines@:
to repeat the movement:norm
stands for normal, any following string is regarded as your keystrokes under normal mode
qa
(store macro into register a
, you can pick your own register like qb
, qc
)5j
q
(finish recording macro)@a
to repeat your recorded operation (replace a
with the register name you picked, eg. @b
, @c
)macro requires more spiritual power to set up but it's more repeatable in the sense that you can store multiple operations in different registers without being overriden by latest operations.
7
Actually .
repeats the last change, not the last normal mode command. As Paul said, you will need a plugin to allow you to repeat motions.
See ":help .
".
4
You can repeat changes with .
. Movements can be repeated with the ;
command. This command seems to be new and does a similar thing to the repmo.vim script mentioned in other answers.
For example, to move to the second next c
, press 2fc
. Then to do it again, just type ;
.
0
You can select the lines you want to change and execute last normal dot command
v5j .............. visual select next 5 lines
:'<,'>norm! . normal mode execute over selection last command '.'
11
;
isn't new. It's a standard vi command. Vi remembers the type and target character (but not numerical argument) of the lastf
/F
/t
/T
motion and;
repeats it. It doesn't repeat other motions, however. – pyrocrasty – 2015-06-04T02:47:48.607This accomplished what I was looking to do! thank you. and thank you @pyrocrasty for the clarification! – Paul – 2018-11-30T18:55:30.000