Vim Cheat Sheet - incl. Vimium & NERDTree
This Vim commands cheat sheet also includes commands and shortcuts for Vimium & Nerdtree.
VIM
Cursor movement
Command | Explanation |
---|
h | left |
j | down |
k | up |
l | right |
w | jump by start of words (punctuation considered words) |
W | jump by words (spaces separate words) |
e | jump to end of words (punctuation considered words) |
E | jump to end of words (no punctuation) |
b | jump backward by words (punctuation considered words) |
B | jump backward by words (no punctuation) |
ge | jump backward to end of words |
0 | (zero) start of line |
^ | first non-blank character of line |
$ | end of line |
- | line upwards, on the first non blank character |
+ | line downwards, on the first non blank character |
<enter> | line downwards, on the first non blank character |
gg | go to first line |
G | go to last line |
nG | go to line n |
:n | go to line n |
) | forward to the next sentence. |
( | backward by a sentence. |
{ | a paragraph backwards |
} | a paragraph forwards |
]] | a section forwards or to the next { |
[[ | a section backwards or the previous { |
H | to the top of the screen. |
M | to the middle of the screen. |
L | to the bottom of the screen. |
fx | search line forward for 'x' |
Fx | search line backward for 'x' |
tx | search line forward before 'x' |
Tx | search line backward before 'x' |
Bookmarks
Command | Explanation |
---|
:marks | list all the current marks |
ma | make a bookmark named a at the current cursor position |
`a | go to position of bookmark a |
'a | go to the line with bookmark a |
`. | go to the line that you last edited |
Insert mode
Command | Explanation |
---|
i | start insert mode at cursor |
I | insert at the beginning of the line |
a | append after the cursor |
A | append at the end of the line |
o | open (append) blank line below current line |
O | open blank line above current line |
<Esc> | exit insert mode |
Editing
Command | Explanation |
---|
r | replace a single character (does not use insert mode) |
R | replace characters rather than inserting |
J | join line below to the current one |
cc | change (replace) an entire line |
cw | change (replace) to the end of word |
c$ | change (replace) to the end of line |
s | delete character at cursor and substitute text |
S | delete line at cursor and substitute text (same as cc) |
xp | transpose two letters (delete and paste, technically) |
u | undo |
CTRL-r | redo |
. | repeat last command |
~ | switch case |
g~iw | switch case of current word |
gUiw | make current word uppercase |
guiw | make current word lowercase |
gU$ | make uppercase until end of line |
gu$ | make lowercase until end of line |
:%retab | fix spaces / tabs issues in whole file |
:r [name] | insert the file [name] below the cursor. |
:r !{cmd} | execute cmd & insert its standard output below cursor. |
CTRL-f | forward by a screen of text |
CTRL-b | backward by a screen of text |
CTRL-u | up by half a screen |
CTRL-d | down by half a screen |
References
- #