10.08.2009

Working with Vi

Positioning the Cursor:

® Move cursor one space right.
¬ Move cursor one space left.
­ Move cursor up one line.
¯ Move cursor down one line.

ctrl-F Move forward one screen.
ctrl-B Move backward one screen.

$ Move cursor to end of line.
^ Move cursor to beginning of line.
:1 Move to first line of file
:$ Move to last line of file
/ Search for a character string.
? Reverse search for a character string.
x Delete the character at the cursor position.
dd Delete the current line.
p Paste data that was cut with x or dd commands.
u Undo.


Entering Input Mode:
a Add text after the cursor.
i Insert text before the cursor.
R Replace text starting at the cursor.
o Insert a new line after the current one.


Entering Command Mode:
esc Switch from Input mode to Command mode.


Exiting or Saving Your File:
:w Write file to disk, without exiting editor.
ZZ Save the file and exit.
:q! Quit without saving.