Cheatography
https://cheatography.com
Navigation - Basic
h |
move left |
l |
move right |
j |
move down |
k |
move up |
Navigation - Word
e |
end of current word |
b |
previous word |
w |
next word |
Can use caps to use \S instead of \w as boundary
Number Power!
[number][movement] |
Same as pressing [movement] [number] times |
[number]i[text] <ESC> |
Insert [text] [number] times |
Navigation - Screen
ctrl + d |
move down a half screen |
ctrl + u |
move up a half screen |
gg |
move to top of file |
G |
move to bottom of file |
NG |
move to Nth line |
Navigation - Search
/[pattern] |
next occurrence of [pattern] |
?[pattern] |
previous occurrence of [pattern] |
* |
next occurrence of word under cursor |
# |
previous occurrence of word under cursor |
Navigation - Special
t{char} |
move before {char} |
f{char} |
move onto {char} |
% |
move to matching parentheses |
0 |
move to start of line |
$ |
move to end of line |
Visual Modes
v |
select from cursor begin to end by character |
V |
select from cursor begin to end by line |
<CTRL>v |
select from cursor begin to end by column, character |
|
|
Commands - Regex
:%s/pattern/txt/ |
replace first pattern of each line with 'txt |
:%s/pattern/txt/g |
replace each pattern of each line with 'txt' |
:%s/pattern/txt/gc |
confirm replace of each pattern of each line with 'txt' |
'/' used above is only a sample, and can be any character (:s@foo@bar@)
Commands - Basic
:w |
save |
:q |
quit |
:wq |
save and quit |
Commands - Inserting Text
a |
append text after cursor |
A |
append text at end of line |
i |
insert text before cursor |
I |
insert text at beginning of line |
o |
begin new line below cursor |
O |
begin new line above cursor |
Commands - Changing Text
r |
replace character under cursor |
R |
enter insert mode and replace characters |
c{navigation} |
change until {navigation} |
Commands - Deleting Text
x |
delete character after cursor |
X |
delete character before cursor |
dd |
delete line |
D |
delete to end of line |
Commands - Copying Text
y{motion} |
yank {motion} text |
yy |
yank line |
p |
put text after cursor |
P |
put text before cursor |
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by Nuggles