Skip to content

Instantly share code, notes, and snippets.

@tdlm
Last active May 17, 2017 16:10
Show Gist options
  • Save tdlm/138bbdf082713e206f3d90243830b8c6 to your computer and use it in GitHub Desktop.
Save tdlm/138bbdf082713e206f3d90243830b8c6 to your computer and use it in GitHub Desktop.
Vim Wizardry
Command Effect
V Visual line highlight.
C-V Visual block highlight.
C-z Suspend Vim and go go shell. Type fg to return to Vim session.
a Append mode.
A Go to end of line and go into insertion mode.
I Go to beginning of line and go into insertion mode.
R Replace mode. (backspace will undo any newly-typed characters!)
o Create a new line below and go into insertion mode.
O Create a new line above and go into insertion mode.
u Undo!
x Delete character under cursor.
dd Delete entire line.
cc Delete entire line and go into insertion mode.
ciw Delete word and go into insertion mode.
cw Delete word from current position forward and go into insertion mode.
ci[char] Delete everything within [char] and go into insertion mode.
da[char] Delete everything within [char].
dit Delete between two XML/HTML tags.
C-a Increment the number under the cursor.
C-x Decrement the number under the cursor.
G Jump to end of document.
gg Jump to beginning of document.

Find & Replace

Command Description
/ Searches in the document for some string.
n Goes to next occurrence of string.
N Goes to previous occurrence of string.
:%s/foo/bar/g Replace all occurrences of 'foo' with 'bar' in the entire document.
:%s/foo//gn Count all occurrences of 'foo' within the document.

Shell Magic

Command Description
:!!figlet "Text" Inserts a figlet-style (3D ASCII) string into the document.
:r [path/to/file.ext] Reads the contents of an external file into the current document at the cursor position.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment