Definition:

  • Vi IMproved
  • learn with vimtutor to learn in 30 mins
  • Modes:
    • command, ESC
    • insert, press i
    • execute, press :
  • Support split-screen

Synopsis:

  • vim [options] [file ..]

List of options:

Command mode:

  • To move to the top, bottom, or specified line of the file:
    • gg — Move to the top of the file.
    • G — Move to the bottom of the file.
    • 42G — Move to line 42 of the file.
  • To move the cursor around the text:
    • h — Move the cursor left.
    • j — Move the cursor down.
    • k — Move the cursor up.
    • l — Move the cursor right.
  • To delete a word, a line, or a specified number of lines of text:
    • d — Delete word at cursor’s position.
    • dd — Delete line at cursor’s position.
    • 3dd — Delete three lines.
  • To copy and paste lines of text:
    • yy — Cut the line at the cursor’s position (yank).
    • p — Put the yanked line at the cursor’s new position (put).
  • To save and close the file:
    • ZZ — Write the file to disk and exit Vim.

Execute mode:

  • :w write file to disk
  • :w newfilename write file with new name to disk
  • :q quit vim
  • :wq
  • :q! quit without writing change

Insert model