Last active
October 7, 2015 01:57
-
-
Save wridgers/3086828 to your computer and use it in GitHub Desktop.
My vim keyboard reference file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------- vim-commands ---------------------------------------------------------- | |
// BASIC CONTROL | |
hjkl - move | |
i - insert mode | |
R - replace mode | |
o - insert new line below | |
O - insert new line above | |
// LINE MOTIONS | |
0 - start of line | |
^ - start of text on line | |
$ - end of line | |
// WORD MOTIONS | |
w - forwards a word | |
W - forwards MORE | |
b - back a word | |
B - back MORE | |
e - end of word | |
E - end of word MORE | |
// PARAGRAPH/SENTENCE MOTIONS | |
( - beginning of sentence | |
) - end of sentence | |
{ - beginning of paragraph | |
} - end of paragraph | |
// DELETE AND CHANGE | |
d[motion] - delete (will also yank) | |
dd - delete line | |
D - delete to end of line | |
c[motion] - delete and enter insert mode | |
cc - delete line, enter insert mode | |
// EXAMPLES | |
d^ - delete from start of line | |
d$ - delete to end of line | |
dw - delete to end of word | |
dj - delete line and line below | |
d} - delete to end of paragraph | |
diw - delete entire word | |
cw - change end of word | |
ciw - change entire word | |
ci" - change inside quotes | |
ci( - change inside brackets | |
// NAVIGATION | |
H - top of screen | |
M - middle of screen | |
L - bottom of screen | |
[num]G - line [num] | |
gg - start of file | |
G - end of file | |
C-d - scroll down by page | |
C-u - scroll up by page | |
f[char] - go to next char | |
F[char] - go to next char (backwards) | |
zt/zb - scroll so cursor's at the top/bottom | |
zz - scroll so cursor's in the middle | |
// CODE NAVIGATION | |
]] - go to start of function | |
[[ - go to end of function | |
% - next (, [, { | |
// CHARACTER ACTIONS | |
x - delete character | |
r - replace character | |
// REPEAT COMMANDS | |
[num] - repeat [num] times | |
. - repeat previous command | |
N[num] - do last command [num] times | |
// VISUAL SELECTION | |
v - visual mode | |
V - visual line mode | |
C-v - visual block mode | |
// COPY PASTE | |
y[motion] - yank (copy) | |
yy - yank line | |
p - paste below | |
P - paste above | |
// SEARCH | |
# - search backwards word under cursor | |
* - search forwards word cursor under word | |
/[text] - search forwards for text | |
?[text] - search backwards for text | |
n - previous | |
N - next | |
// SPELLING | |
<F6> - toggle spell checking (CUSTOM) | |
]s - next misspelling | |
[s - previous misspelling | |
z= - suggestion | |
zg - add to good word list | |
zG - add to good word list INTERNALLY (temp) | |
zw - mark as bad word | |
zW - mark as bad word INTERNALLY (temp) | |
// UNDO/REDO | |
u - undo | |
C-r - redo | |
// WORK WITH LINES | |
J - join lines | |
= - auto-indent | |
< - indent left | |
> - indent right | |
// MARKERS | |
m[a-z] - set marker a-z | |
'[a-z] - go to marker | |
// MACROS | |
q[a-z] - record marco to register [a-z] | |
q - stop recording | |
@[a-z] - do [a-z] | |
@@ - do it again! | |
// BUFFERS | |
:ls - show a list of buffers | |
:b # - open buffer with number # | |
// WINDOWS | |
C-W s - open a new window (horizontal split) (dupe buffer) | |
C-W v - open a new window, vertical split (dupe buffer) | |
C-W n - open a new blank window, horizontal | |
:vnew - open a new blank window, vertical | |
C-W q - quit a window | |
C-W c - close a window | |
// WINDOWS - FOCUS | |
C-W hjkl - move focus | |
C-W p - previous window | |
C-W o - make the window the only one | |
// WINDOWS - MOVE | |
C-W r - rotate windows rightwards | |
C-W R - rotate windows leftwards | |
C-W x - exchange current with next | |
C-W HJKL - move window | |
C-W T - move to new tab | |
// WINDOWS - RESIZE | |
C-W = - make windows equal size | |
C-W - - decrease height | |
C-W + - increase height | |
C-W < - decrease width | |
C-W > - increase width | |
// TABS | |
:tabnew - open new tab page | |
:tabclose - close tab page | |
:tabonly - close other tabs | |
// TABS - FOCUS | |
gt - next tab | |
gT - prev tab | |
:tabfirst - first tab | |
:tabnext - next tab | |
// TABS - MOVE | |
:tabmove [N]- move tab after tab N | |
// TABS - CMDS | |
:tabdo {cmd}- do cmd in each tab | |
// CODE FOLDING | |
zc - close fold | |
zo - open fold | |
za - toggle | |
zC - really close fold | |
zO - really open fold | |
zA - really toggle fold | |
zr - open by one globally | |
zR - open all | |
zm - close by one globally | |
zM - close all | |
-------- bufexplorer -- script ------------------------------------------------- | |
\be - explore in current window | |
\bs - explore in split | |
\bv - explore in vert | |
o - open | |
t - open in new tab | |
D - delete | |
R - path toggle | |
T - tab toggle | |
-------- NERDtree -- script ---------------------------------------------------- | |
o - open | |
i - open in split | |
s - open in vert. split | |
g[action] - do action, stay in nerd | |
q - close nerdtree | |
-------- vim-signature -- script ----------------------------------------------- | |
m[a-zA-Z] - toggle marker | |
m<space> - unset all markers | |
m, - set next marker | |
]` - go to next marker | |
]' - go to start of next line with marker | |
`] - next (alphabetical) | |
'] - start of line of next marker (alphabetical) | |
m[0-9] - toggle the corresponding marker !@#$%^&*() | |
m<S-[0-9]> - unset markers of same type | |
]= - go to next line with same marker | |
]- - go to prev line with same marker | |
m<bspace> - unset all | |
-------- vim-commentary -- script ---------------------------------------------- | |
gc - toggle comment selection | |
gc[motion] - toggle comment | |
gcc - toggle comment line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment