Vim tricks

  • Q in normal mode to execute the last recorded macro.
  • Use \{-} as non-greedy regex symbol.
  • Use \_. to match any character including newline (multi-line).
  • Use \Vpattern (very non-magic) to match the pattern literally, only ^ and $ will have special meaning.
  • Classic negative/positive lookahead/behind (example in very magic):
lookbehind lookahead
positive (atom)@<= (atom)@=
negative (atom)@<! (atom)@!
  • Use \L (eg.: s/.*/\L&/) to lowercase the match; use \U (eg.: s/.*/\U&/) to uppercase it.

You may also like...

Using two-way merge/conflict tool in (n)vim