Command | Description |
ysw" | add surrounding word with " |
cst< | change surround tag |
<V> :sort | sort selected lines |
zt | current line goes to top |
zb | current line goes to bottom |
^e | scroll but preserve cursor position |
^y | scroll top but preserve cursor position |
^z | pause vim and play in the terminal |
fg | return to vim |
>i{ | one indent inside curly brackets (or > i B ) |
=i{ | indent inside curly brackets |
^vI | enter visual block then add a prefix ‘#’ |
% | matches equal pairs |
@@ | execute last macro |
:reg | lists all registers (macros included) |
gv | resume the previous visual mode selection |
gJ | join without whitespace |
g_ | jump to the last non-blank char of the line |
Y | same as yy |
"0 | contents of the latest yank |
~~~ | change case |
ZZ | save and quit |
ZQ | save without quitting |
:x | same as :wq |
[) | next close parens |
[} | next close curly braces |
'' | move to last cursor position |
'. | jump to last modification |
`. | jump to exact last modification |
". | last inserted text |
": | last executed command |
@: | execute last command |
<C-O> | retrace (backwards) your movements in a file (:jumps) |
<C-I> | retrace (forward) your movements in a file (:jumps) |
g; | cycle through changes (backwards) |
g, | cycle through changes (forward) |
<I> ^r = | execute an expression and paste it into the buffer |
:marks | list of marks |
ea | append at the end of a word (better than eli ) |
:tabnew | creates a new tab |
:tabclose | closes the current tab |
:r! {cmd} | pastes the content of cmd into the buffer |
^w < | vertically shrinks the window |
^w > | vertically enlarges the window |
<C-a> | increment number |
<C-x> | decrement number |
]m | next method |
[m | previous method |
( | move to beginning of current sentence |
) | move to beginning of next sentence |
[\[ | move to beginning of current section |
]] | move to beginning of next section |
gd | go to definition (TAGS) |
gf | edit file at current position |
gF | edit file at line N at current position (file.py:N) |
:g/pattern/d/ | delete all lines matching a pattern (g! negates) |
:g/^\s*$/d | delete blank lines |
:e . | directory explorer |
<I> ^n | next keyword completion |
<I> ^p | previous keyword completion |
:windo difft | diff on all open windows |
+ | move to first char of next line |
- | move to first char of previous line |
:20vs . | create visual split with the file structure of a dir |
d?text | delete until search (?/) |
"1p." | increments the buffer number of the register |
"qp | paste contents of register q |
"qY | yank the contents of the current line into register q |
:= | print all lines |
1,10w file | write line 1 through 10 to a new file |
1,10w >>file | append line 1 through 10 to an existing file |
:r file | read file and paste contents on current line |
S | (same as cc ) erase line and enter insert mode |
nH | move n lines below top line |
nL | move n lines above last line |
# | match previous word under cursor |
g# | match previous word under cursor <unlisted> |
* | match next word under cursor |
g* | match next word under cursor <unlisted> |
:grep | starts the grep command |
<V> o | go to the other end of the highlightext text |
C-j | newline |
gi | back to previous insert mode |
ga | show character encoding info |
gq<Enter> | format paragraphs |
C-r <macro> | show contents of macro recording |