Last edit: March 24, 2019 01:30:18 PM CDT
List of all cheatsheets
Vim
Moving around
H/J/K/L move cursor one character at a time
w/W move forward by word
b/B move backward by word
0 jump to start of line
$ jump to start of line
# [number] jump to line number
G jump to end of the file
ge jump to end of word
( ) move to previous/next sentence
{ } move to previous/next paragraph
ctl E or ctl Y scroll up/down a line
ctl D or ctl U scroll up/down a half a page
ctl F or ctl B scroll up/down a page
zt set current line at top of window
zz set current line at center of window
Insert
i insert at cursor
I insert at start of line
a append at cursor
ea append at end of word
A append at end of line
o start a new line below current line
O start a new line above current line
Editing
u undo
x/X delete character forward/backward
dw delete word
dl delete line
ctl U delete all inserted characters in current line
r replace character
R replace characters starting at the cursor
C change to the end of the line
J join line with line below it
:r /path/to/file insert contents of file below cursor
:r! cmd insert output of command below cursor
cw cut word
cc cut line
yy copy text into buffer
p/P paste forward/backward
v visual edit
- aw select word
- ab then {} select block
wq save and exit
[number] cmd perform action on X number of lines
Search
/ [term] search forward
? [term] search backward
n/N repeat search forward/backward
# or * search backward or forward for word under cursor
ctl g show line number
Find and replace
%s/termToReplace/newterm/g
Temporarily drop back to the shell
! [command], e.g. ! ls -al
Enable line numbers
:set number
Turn on syntax coloring
Add “syntax on” to ~/.vimrc