Skip to content

Instantly share code, notes, and snippets.

@nicolas-martin
Last active February 10, 2020 22:30
Show Gist options
  • Save nicolas-martin/7f8a66291b472393e04d79b9596fdb9c to your computer and use it in GitHub Desktop.
Save nicolas-martin/7f8a66291b472393e04d79b9596fdb9c to your computer and use it in GitHub Desktop.

Vim Keys

Movement

  • $ end of line
  • 0 Start of the line
  • { / } Jump to next / previous paragraph.

Deletion

  • dw Deletes the next word
  • d3w Deletes 3 words
  • d$ Delets until the end of line
  • di( Deletes inside the (. Can be replace with any other char ", {, etc..
    • d% does the same thing
  • dd Deletes the entire line
  • 2dd Deletes 2 lines

Misc

  • u Reverts the last change
  • U Reverts the entire line
  • / Search
    • n move to the next
    • N move to the last

Replace

  • r Replaces the character under the cursor
  • ci( Changes the text inside ( and enters insert mode. Can be replace with any other char ", {, etc..
    • c% does the same thing
  • ce Changes until the end of word.

Cusor location

  • G Bottom of the file
  • gg Start of the file
  • [#]G Jump to line [#]
  • % Move the corresponding (, [, {

Code folding

  • za: Toggle code folding at the current line. The block that the current line belongs to is folded (closed) or unfolded (opened).
  • zo: Open fold.
  • zc: Close fold.
  • zR: Open all folds.
  • zM: Close all folds.

Surround

  • cs"': Change surround from " to '
  • ds": Delete surround "
  • ysw": Add "" around w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment