Vim

Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient.

Operators

  • c - change
  • d - delete
  • y - yank into register
  • gU - make uppercase
  • gu - make lowercase
  • > - shift right
  • < - shift left

View the complete list by running :h operator

Motions

Word motions

  • w, [count] words forward - Deliminated by non-keyword characters
  • W, [count] WORDS forward - Deliminated by whitespace
  • e forward to end of word [count]
  • E forward to end of WORD [count]
  • b - [count] words backward
  • B - [count] WORDS backward

View the complete list by running :h word-motions

Text object motions

View the complete list by running :h object-motions

Selections

  • ap - A paragraph
  • ip - Inner paragraph

Completion

  • <C-x><C-f> - File completion

Typed commands

  • :buffer :b - Edit buffer from the buffer list
  • :find - Find {file} in path and :edit it
  • :sort - Sort lines in [range]. When no range is given all lines are sorted

Key commands

Change

  • c{motion} - "Change" - Delete {motion} text [into register x] and start insert
  • cc - Delete [count] lines [into register x] and start insert
  • C - Delete from cursor to end of the line [into register x] and start insert

Delete

  • d{motion} - Delete text that {motion} moves over [into register x]
  • dd - Delete [count] lines [into register x] linewise
  • D - Delete the characters under the cursor until the and of the line

Upper/lower case

  • gU{motion} - Make motion text uppercase
  • gu{motion} - Make motion text lowecase
  • {visual}U - Make highlighted text uppercase
  • {visual}u - Make highlighted text lowercase

Scrolling relative to cursor

  • zt - Redraw, line [count] at top of window
  • zz - Redraw, line [count] at center of window
  • zt - Redraw, line [count] at bottom of window

Editing text

  • a - Append text after the cursor
  • A - Append text at the end of the line

Resources