Skip to content

Instantly share code, notes, and snippets.

@FabioAntunes
FabioAntunes / vim-cheat-sheet.md
Last active March 17, 2021 17:06
Vim cheat sheet

Search (and replace)

  • /[pattern] search forward for pattern
  • ?[pattern] search backward for pattern
  • n repeat search forward
  • N repeat search backward
  • * search for word currently under cursor
  • g* search for word partially under cursor
  • [I show lines with matching word under cursor
  • %s/background/&-color/g find and replace background with background-color. & inserts the matched pattern %s/\(foo\)bar/\1baz/g find and replace foobar with foobaz. \1 uses the captured group foo from the \(\)