Last active
December 23, 2015 13:05
-
-
Save kofrasa/20f2554396fcf2515fa3 to your computer and use it in GitHub Desktop.
This file contains 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
Command Structure | |
================= | |
[count]<verb><modifier><target> | |
<target> = <object|motion> | |
Navigation (Motion) | |
=================== | |
h,j,k,l - left, down, up, right (respectively) | |
0 - beginning of line | |
^ - first character of line | |
$ - end of line | |
gg - beginning of buffer | |
G - end of buffer | |
b - beginning of current word | |
e - end of current word | |
w - beginning of next word | |
B - beginning of current big word (ignores delimiters within string) | |
W - beginning of next big word (ignores delimiters within string) | |
% - jump to matching tag/parenthesis/bracket/block | |
) - next sentence | |
( - previous sentence | |
} - next paragraph | |
{ - previous paragraph | |
f<CHAR> - move forward to next <CHAR> | |
F<CHAR> - move back to previous <CHAR> | |
t<CHAR> - move forward to just befor next <CHAR> | |
H - move to top of screen | |
M - move to middle of screen | |
L - move to bottom of screen | |
Searching (Motion) | |
================== | |
/<PATTERN> - search for pattern | |
\< - beginning of word | |
\> - end of work | |
n - go to next string (after executing search) | |
N - go to previous string (after executing search) | |
Commands (Verbs) | |
================ | |
Edit/Delete | |
----------- | |
c - change (eg. ciw - "change inside next word") | |
s - substitute character at cursor | |
x - delete character at cursor | |
r<CHAR> - replace character at cursor with <CHAR> | |
d - delete object (eg. ds - "delete next sentence") | |
dd - delete current line | |
D - delete from cursor to end of line | |
J - join/concat current line with next one (ie. remove newline separator) | |
Copy/Paste | |
---------- | |
y - yank/copy text | |
yy - yank the current line | |
p - paste after cursor position | |
P - paste before cursor position | |
Indenting | |
--------- | |
> - indent block (visual mode) | |
< - dedent block (visual mode) | |
>> - indent block | |
<< - dedent block | |
== - fix line indent | |
gu - convert to lowercase | |
Inserting | |
--------- | |
i - insert before cursor | |
a - append before cursor | |
I - insert before first text on current line | |
A - append after last text on current line | |
o - open new line below cursor | |
O - open new line above cursor | |
Undo/Redo | |
--------- | |
u - undo change | |
<C-r> - redo changes which were undone | |
Markers & Registers | |
------------------- | |
m<ALPHA> - mark the current position of cursor as <ALPHA> (<ALPHA> is [a-z]) | |
'<ALPHA> - go to beginning of line at marker <ALPHA> | |
`<ALPHA> - go to precise location of marker <ALPHA> | |
"<ALPHA> - setup register <ALPHA> as input/output for command/verb. | |
Eg. "add - deletes current line and store in register "a | |
Modifiers | |
========= | |
a<TARGET> - around/all <TARGET> | |
i<TARGET> - inside/in <TARGET> | |
Objects | |
------- | |
w - word | |
s - sentence | |
p - paragraph | |
t - matching tags | |
> - single tag | |
" - matching double quotes | |
' - matching single quotes | |
` - matching back quotes | |
} - matching braces | |
] - matching square brackets | |
) - matching parentheses | |
% - matching tags, parentheses, brackets, or block | |
Extra Objects | |
------------- | |
a - argument (https://github.com/vim-scripts/argtextobj.vim) | |
i - current indentation level (https://github.com/michaeljsmith/vim-indent-object) | |
r - ruby block (https://github.com/nelstrom/vim-textobj-rubyblock) | |
Visual mode | |
=========== | |
v - enter visual mode | |
Shift-v - enter linewise visual mode | |
File Commands | |
============= | |
:e - edit file | |
:e! - edit file discarding unsaved changes | |
:r <FILE> - read <FILE> and insert below the cursor | |
:r !<CMD> - execute <CMD> and insert stdout below the cursor | |
:w - write file | |
:q - quit file | |
:q! - force quit without saving changes | |
ZQ - same as :q! | |
:wq - write and quit | |
ZZ - same as :wq | |
:saveas <FILE> - save file to <FILE> | |
:u - undo one change | |
:<NUM> - go to line <NUM> in file | |
:source <FILE> - read contents of <FILE> as a series of commands | |
:so <FILE> - shorthand for :source | |
Windows | |
======= | |
<C-w> - prefix for window commands | |
r - rotate windows | |
x - swap the current window with the next one | |
Shift-<H|J|K|L> - move current window left, down, up, right (respectively) | |
> - increase size of current window | |
< - decrease size of current window | |
<DIR> - change focus to the window in the direction <DIR> | |
Tags | |
==== | |
<C-]> - Jump to the tag underneath the cursor | |
<C-t> - Jump back up in the tag stack | |
:ts <tag> - Search for a particular tag | |
:ts - List all of the definitions of the last tag | |
:tn - Go to the next definition for the last tag | |
:tp - Go to the previous definition for the last tag | |
:tf - Go to first tag | |
:tl - Go to last tag | |
Misc | |
==== | |
:colorscheme <SPACE> <TAB> - list all installed color schemes | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment