VIM stuff

Some vimrcs

Moving Around

  • h, j, k, l - left, down, up, right
  • w - move to START of next word
  • e - move to the END of the next word.
  • b - nove back a word
  • gg - top of file
  • G - bottom of file
  • 23G - jump to line
  • $ - jump to end of line
  • 0 - jump to start of line
  • fc - go forward to character c (any character)
  • Fc - go backward to character c

Deleting, editing, etc.

  • d - delete, a motion… e.g., dw means “delete word”
  • x - delete where cursor is
  • y - “yank” operator, aka copy
  • p - paste after cursor
  • P - paste before cursor
  • c - “change” operator, cw = change word
  • u - undo a sinlge change
  • r - redo a single change
  • Ctrl + r - redo a single undo
  • a - append, aka start typing after the cursor
  • A - append from end of line
  • o - start inserting on a new line
  • O - start inserting on a new line from prev line
  • C - delete rest of line from cursor, and start inserting.

Confusingly, doubling a motion means to do it for a line?

  • yy - yank a line
  • dd - delete a line


  • / - search motion, aka forward motion. after running a search, you can use n to jump through search results. N moves backwards.k
  • ? - same as /, but searches backwards.


  • v - enter “visual” mode for selecting text.
  • V - enter “visual line” mode for selecting whole lines

Text Objects

  • “Text Objects” are blocks of text with their own starting or ending characters, like { or ().
  • Text objects can be manipulated with the other operators, like y, c, and d, and v
  • In general, defining a text object with i will be the so-called “inner” object, while defining a text object with a will be “an” object


  • di( will delete everything in parentheses
  • da( will delete everything in the parentheses, including the parentheses
  • ci( will change everything in the parentheses
  • yi( will yank everything in the parentheses
  • dit will delete everything within a current html tag (t here automatically knowing it’s HTML!)
Last modified: December 08, 2020
© 2024