vim For Emacs Users


Some notes about normal mode

Many of the commands accepted in vi's normal mode can be prefixed with a count. This facility is very similar to Emacs's ^Un function, except that you don't have to do anything special to supply a count. (I'm not enough of a vim maven yet to say whether the count facility can be used to repeat absolutely any command, as in Emacs.) For example, 3j moves down three lines.

Furthermore, commands that act on a range of text accept a movement command as a suffix, which tells the command how much text to act on. For example, dj deletes everything between the current line and the line reached by the command j, inclusive. Therefore, it deletes two lines: the current line, and the line below. d3j would delete four lines.

Note that the movement command following d is a fully-formed command, including a prefixed repeat count. That means that d3j does something different than 3dj:

  • d3j deletes everything between the current line and the line 3j below, inclusive; it therefore deletes four lines total.
  • 3dj repeats the command dj three times -- and since dj deletes two lines (everything between here and j, inclusive), that means that 3dj deletes six lines.
Confusing these two cases is likely to lead to wailing and gnashing of teeth.

Last changed:
01-26-06 10:59:29


This page was rendered by LittleSite.
LittleSite is Copyright (c) 2005 by J.Knapka.
Questions and comments to JK