Modes
Normal Mode |
Enter commands, navigate |
Insert Mode |
Insert text |
Visual Mode |
Select text |
Visual (line) Mode |
Select entire line |
Visual (block) Mode |
Select block of text |
Commands
$> vim . |
open current directory in vim |
$> fg |
return to 'foreground' (paused process) |
CTRL-Z |
pause vim / show command prompt |
:tabnew |
new tab (blank file) |
:tabnew 'path/to/file' |
open file in new tab |
:e 'path/to/file' |
open file in current tab |
:E |
view current directory in current tab |
:r 'path/to/file' |
copy contents of file into current tab |
:w |
write changes |
:q |
close tab |
:qa |
close all tabs |
:spl |
split window |
:vsp |
vertical split window |
CTRL-ww |
switch between split windows |
|
|
Navigation
h |
left one character |
l |
right one character |
j |
down one line |
k |
up one line |
gg |
jump to top of file |
G |
jump to end of file |
CTRL-f |
page down |
CTRL-b |
page up |
0 |
jump to beginning of line |
$ |
jump to end of line |
w |
jump to beginning of next word |
W |
jump to beginning of next camel-case word |
b |
jump to beginning of previous word |
B |
jump to beginning of previous camel-case word |
e |
jump to end of current word |
E |
jump to end of camel-case word |
^ |
jump to first character on line |
% |
jump to matching brace |
Normal->Insert Commands
i |
insert (before current character) |
o |
new line (below) |
shift-o |
new line (above) |
a |
append (insert after current character) |
shift-a |
append to end of line |
c |
change selection |
cw |
change from current character to the end of the word |
c shift-w |
change from current character to end of camel-case word |
ci* |
change in between: t,",',(,{,[ |
ca* |
change around: t,",',(,{,[ |
Insert Commands
esc |
switch to normal mode |
fn-F5 |
switch to insert paste mode |
CTRL-Y |
copy from line above |
|
|
Edit (Copy/Paste)
d |
delete selection |
dd |
delete line |
y |
copy ('yank') selection |
yy |
copy ('yank') line |
x |
delete character |
r |
replace character |
di* |
delete in between: t,",',(,{,[ |
da* |
delete around: t,",',(,{,[ |
dw |
delete until end of word |
d shift-w |
delete until end of camel-case word |
p |
paste after/below |
shift-p |
paste before/above |
Visual Block Commands
esc |
switch to normal mode |
shift-i |
insert multiline |
c |
replace multiline |
Search and Replace
/[regEx] |
search for instances of [string] |
n |
jump to next result |
shift-N |
jump to previous result |
:%s/[regEx]/[string]/gc |
search for regEx, replace with string w/ global and confirm options |
/[space]\+$ |
find trailing white spaces |
|