Basic commands:

  • i: insert mode
  • Esc: document navigation mode
  • u in navigation mode: undo
  • CTRL + R: redo
  • :q: exit
  • :q!: exit without saving
  • :wq: save and exit
  • :w: save
  • /[word to search]: search a word
  • :[line number]: go to the specified line

Save custom settings permanently

Windows

Append the instructions (e.g., :set number) to C:\Users\<username>\_vimrc

Linux

Append the instructions (e.g., :set number) to ~/.vimrc

Line numeration

  • :set number: display line numbers
  • :set nonumber: hide line numbers

Spell Check:

Append the following line to ~/.vimrc:

  • :setlocal spell spelllang=en_us: enable the spell check
  • :set nospell: disable spell check

Syntax Highlighting

  • :syntax on: enable the syntax highlighting
  • :syntax off: disable the syntax highlighting