Skip to content

Instantly share code, notes, and snippets.

@lamosty
Last active October 20, 2018 13:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lamosty/150f32208dcc74f7ca37 to your computer and use it in GitHub Desktop.
Save lamosty/150f32208dcc74f7ca37 to your computer and use it in GitHub Desktop.
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