Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to code in Vim — Commands, a video tutorial on Youtube: https://www.youtube.com/watch?v=hax7BEobOJQ

Command (normal) mode:

File

  • :w - save file
  • :q - close file
  • :q! - close file without saving
  • :x - save and close

Navigation

  • h - left
  • j - down
  • k - up
  • l - right
  • gg - beginning of the file
  • G - end of the file
  • ^ - beginning of line
  • $ - end of line
  • Ctrl + d - page down
  • Ctrl + u - page up
  • % - matching/closing parentheses (or tag in HTML)

Undo/Redo

  • u - undo
  • Ctrl + r - redo

Working with text:

  • i - insert before caret
  • a - insert after caret
  • o - new line below current line and switch into insert mode
  • O - new line above current line and switch into insert mode
  • x - deletes character under caret
  • d - delete selected characters/lines
  • dd - deletes current line
  • r - replace character under caret with new character you write next

Visual mode:

  • v - switch to visual mode and character selection
  • V - switch to visal mode and line selection
  • Ctrl + v - switch to visual mode and block selection
  • y - copy selection
  • p - paste below current line
  • P - paste above current line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment