4

I read that . is used for repeating the last command in Normal Mode. So if I used the command 2w move forward two words and then press . then I would expect to move two words more however this does not happen.

Could anyone please tell me why ?

  • 2
    Where did you read that . repeats the last command? Not in :help ., that's for sure. – romainl Mar 19 '16 at 10:24
3

As stated in :h . the dot command only repeat changes, but commands like w are motions not changes.

You can repeat motions like f, F, t and T with the commands ; and g; (see :h ;). And for more complex repeat you could have a look to the easymotion plugin readme: combined with vim-repeat you might be able to repeat the movements the way you want to do it.

3

Vim answers this in the help about the dot command:

.           Repeat last change, with count replaced with [count].
            Also repeat a yank command, when the 'y' flag is
            included in 'cpoptions'.  Does not repeat a
            command-line command.

So . simply repeats the last change, not motions, or command-line commands.

  • 1
    I wonder if there is a way to "repeat the last motion command", though? – Wildcard Mar 19 '16 at 8:40
  • 2
    @Wildcard: for f, F, t and T motion you can use ; (:h ;) – statox Mar 19 '16 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.