Search code examples
vimiterm2

Vim: colon appends .,.+3


Sometimes when entering :, vim appends .,.+3 to it, preventing me from executing a command. I couldn't find anything about this behaviour online, is there a way to get do away with it? At the moment, I use vim 8.0 (in iTerm2) but it also used to occur in earlier versions.


Solution

  • This happens when you typed a number before the colon. Vim interprets it as the number of lines on which you want your ex command to operate.

    If you press 4: you get :.,.+3 which is a range that covers the current line (.) and the three lines below the current line (.+3).

    That behavior is old and documented in :help N: (:help :range is an interesting read, too).

    If you want to get rid of that range, see :help <C-u>.