VIM commands

Linux

·

1 min read

  • vim file.txt - Open a file
  • :q - to quit
  • :wq - Save and quit
  • :q! - Quit without saving
  • :set number - Show line numbers
  • dd - Remove the selected line
  • 2dd - Remove two lines counting from the selected line
  • u - It is the traditional Ctrl + z
  • ctrl + r - It does an undo

  • i - Enter in Edit. In that mode, it is a normal editor

  • ESC - Exit from edit mode

Search

  • /myTextIWantSearch - Forward
  • n + Enter - Next occurrence
  • ?myTextIWantSearch - Backward
  • n + Enter - Next occurrence
  • /\<myTextStartWith - It search for words that starts with myTextStartWith
  • /\ - Exactly that text