Skip to content
Published April 20, 2022
From terminal, vim <filename> to open vim
  • <:> start writing commands
    • <q> quit
    • <wq> write and quit
    • <q!> quite but don’t write
  • <escape> leave edit mode
  • <dd> delete a line
    • <3dd> delete three lines
  • <escape><u> undo changes
  • <ctrl-r> redo changes
  • </ “searchterm”> moves cursor to first text of “searchterm”
    • <n> next text found of “searchterm”
    • <shift+n> previous text found of “searchterm”
  • <%s/”pattern to replace”/”replacement term”/gc> search and replace “pattern to replace” with “replacement term”. “gc” adjusts this greedy confirm – it will change the first one and asks to confirm each change.
  • <%s/”pattern to replace”/”replacement term”/g> same as above but will not ask for confirmation.

Comments are closed.