Common vi commands

Posted by Tully on Mon 11 May 2009

dw

Deletes the word that comes immediately after the cursor, including the space following the word. The text is saved in a memory buffer.

de

Deletes the word that comes immediately after the cursor, not including the space. The text is saved in a memory buffer.

d\$

Deletes from the insertion point to the end of the line. The text is saved in a memory buffer.

dd

Deletes the entire current line. The text is saved in a memory buffer.

p

Inserts the text deleted in the last deletion operation after the current cursor location.

u

Undoes the last action.

CTRL-G

Displays a status line at the bottom of the interface. This displays the name of the file, the total number of lines in the file, and the current cursor location.

/search_term

Searches for the next instance of the term specified.

For example, entering /init searches for the next instance of the text "init" after the cursor. Pressing N after executing a search will search for the next instance of the search term.