Linux Editor: VI help sheet

Vim Help Sheet

Modes and Controls

  • Command Mode: ESC
  • Insertion Mode

Basic commands

  • :wSave
  • :xSave and exit
  • :qQuit if no changes made
  • :q!Quit and discard any changes
  • uUndo last change
  • UUndow all changes to line
  • .Repeat last command

Cursor Navigation

  • h or arrow left Cursor left
  • j or arrow down Cursor down
  • k or arrow up Cursor up
  • l or arrow right Cursor right
  • w Next word
  • W Next blank delimited word
  • b Start of word
  • B Start of blank delimited word
  • e End of word
  • E End of blank delimited word
  • ( Back a sentence
  • ) Forword a sentence
  • { Back a paragraph
  • } Forword a paragraph
  • 0 Beginning of current line
  • $ End of the current line
  • H Top of screen
  • M Middle of screen
  • L Bottom of screen

Insert Text

  • iInsert before cursor
  • aAppend after cursor
  • IInsert before line
  • AAppend after line
  • oAdd a new line after current line
  • OAdd a new line before current line
  • rOverwrite one character
  • ROverwrite many character
  • :r FILE_NAME Reads file and insert it after this line

Deleting Text

  • xDelete character to right of cursor
  • XDelete character to left of cursor
  • DDelete the rest of line
  • dd or :dDelete the current line

Searching

  • /stringSearch forword for string
  • ?stringSearch backword for string
  • nGo to the next match
  • NGo to the previous match
  • :set nuTurn on the line numbers