Created
February 22, 2018 14:43
-
-
Save clawoflight/6a638efef9b504011b0d1bbd839c25ec to your computer and use it in GitHub Desktop.
Vim Cheatcheet
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
vim: sw=4 ts=4 et | |
Normal Mode | |
==================== | |
General | |
-------------------- | |
u undo | |
U undo all changes on last modified line | |
^r redo | |
d delete (input motion) | |
dd delete line | |
p paste after/below cursor | |
y copy (input motion) | |
Mode Switching | |
-------------------- | |
i insert before cursor | |
I insert at beginning of line | |
a insert after cursor | |
A insert at EOL | |
o insert new line below | |
O insert new line above | |
r replace char | |
R replace | |
c change: delete until motion and insert mode | |
v visual | |
^v visual block | |
V visual line | |
Motion | |
-------------------- | |
w next word | |
e end of next word | |
f advance to char (input next char) | |
t advance before char (input next char) | |
^o jump back | |
^i jump forward | |
^^ beginning of line | |
0 beginning of line | |
$ EOL | |
% matching paren | |
space easymotion word jump | |
\j\k easymotion go to line | |
\\f easymotion character jump | |
\\w easymotion forward word jump | |
zENTER current line to top of screen on first char | |
zt current line to top of screen | |
zz center current line in screen | |
z. center current line on first char | |
zb current line to bottom of screen | |
Programming/Keywords | |
-------------------- | |
gd goto definition/first occurence highlighting uses --> very useful for scoped variables! Use ctags ^] for globals. | |
K open man-page | |
^] ctags go to definition | |
^t ctags location history | |
^w} ctags open definition in preview window | |
= indent lines (input motion) | |
Window management | |
-------------------- | |
^ws hsplit | |
^wv vsplit | |
^wo maximize window | |
^wq close window | |
^whjkl move to window | |
^wHJKL move buffer to window/change split direction | |
^wz close preview windows | |
Insert Mode | |
==================== | |
^n^p next/previous dictionary completion | |
^y accept deoplete completion | |
^o go to normal mode for 1 command, then go back to insert mode --> use to access easymotion, or twice to go back | |
Commands | |
==================== | |
:noh get rid of highlighting from search or gd | |
:s replace (prepend range: % for entire file, N,N for lines. Append /g or /c for multiples and confirmation) | |
:! shell command | |
:w FILE write | |
:r FILE load content from file (or command with !, e.g. :r !uname) | |
:StripWhitespace | |
:NerdTree | |
:Tagbar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment