|
|
Command derived from plugin
|
|
|
Command derived from preferences
|
.vimrc for this cheatsheet available on Github brennanmeadowcroft/dotfiles
:help <keyword> |
Open help for a keyword
|
:o <file> |
Open file
|
:saveas <file> |
Save file as
|
:close |
Close current pane
|
<n><command> |
Do n of command (e.g.
5dd) |
<Esc> |
Change to normal mode
|
<Leader> is ,
:w |
Write (save) current file but don't exit
|
:Q |
Quit ALL buffers (fails if unsaved changes)
|
:q |
Quit current buffer (fails if unsaved changes)
|
:q! |
Force quit
|
:wq/:x |
Write (save) and quit
|
qa |
Record macro
a |
qq |
Stop recording macro
|
@@ |
Rerun last macro
|
_n_@a |
Run macro
a _n_ times |
|
Marking Text |
|
v |
start visual mode
|
V |
start linewise visual mode
|
Ctrl+v |
Start visual block mode
|
aw |
Mark a WORD
|
ab |
Mark AROUND block of ()
|
aB |
Mark AROUND block with {}
|
ib |
Mark INSIDE block with ()
|
iB |
Mark INSIDE block with {}
|
|
Visual Commands |
|
> |
Shift highlighted lines right
|
< |
Shift highlighted lines left
|
y |
Yank (copy) marked text
|
d |
Delete marked text
|
~ |
Switch case of marked text
|
A |
Append to end of line
|
a |
Start inserting after cursor
|
i |
Start inserting before cursor
|
|
Keyword Completion |
|
Ctrl+n |
Keyword completion (e.g. variable names)
|
Tab |
Keyword completion
|
Ctrl+n |
Move DOWN in autocomplete window
|
Ctrl+p |
Move UP in autocomplete window
|
i |
Insert BEFORE cursor
|
I |
Insert at beginning of line
|
a |
Insert AFTER cursor
|
A |
Insert at end of line
|
o |
Insert new line BELOW current line
|
O |
Insert new line ABOVE current line
|
ea |
Insert at end of the word
|
h |
Move cursor left
|
j |
Move cursor down
|
k |
Move cursor up
|
l |
Move cursor right
|
H |
Move cursor to TOP of screen
|
M |
Move cursor to MIDDLE of screen
|
L |
Move cursor to BOTTOM of screen
|
w |
Jump forward to START of word
|
e |
Jump forward to END of word
|
^ |
Jump to first non-blank character of line
|
$ |
Jump to end of the line
|
O |
Jump to start of the line
|
Ctrl+b |
Page Up
|
Ctrl+f |
Page Down
|
_n_G |
Go to line _n_
|
gg |
Go to the first line of the document
|
G |
Go to the last line of the document
|
} |
Jump to next paragraph (or function/block)
|
{ |
Jump to previous paragraph (or function/block)
|
Ctrl+y |
Scroll up without moving cursor
|
Ctrl+e |
Scroll down without moving cursor
|
|
Within Buffer |
|
/_keyword_ |
Search buffer for _keyword_
|
n |
Move DOWN to next instance
|
N |
Move UP to next instance
|
* |
Search buffer for word under cursor
|
|
Within Working Directory |
|
<Leader>+a |
Search (ack) INSIDE files in working directory
|
v |
Open file from search (ack) in VERTICAL split
|
h |
Open file from search (ack) in HORIZONTAL split
|
|
Replace |
|
:%s/_old_/_new_/g |
Replace all _old_ throughout file with _new_
|
:%s/_old_/_new_/gc |
Replace _old_ with _new_ WITH CONFIRMATIONS
|
|
Marks |
|
:marks |
List of marks
|
ma |
Set current position for mark
a |
`a |
Jump to position of mark
a |
|
Registers |
|
:reg |
Show registers content
|
"xy |
yank into register
x |
"0p |
Paste contents of register x
|
J |
Join line below to current one
|
cc |
change (replace) entire line
|
cw |
change (replace) to end of word
|
c$ |
change (replace) to end of line
|
s |
delete character and substitute text
|
xp |
transpose two letters
|
u |
undo
|
Ctrl+r |
redo
|
. |
Repeat last action
|
ci_char_ |
Change INSIDE _char_ (e.g.
ci") |
ca_char_ |
Change AROUND (including) _char_ (e.g.
ca") |
zc |
Close a fold
|
zo |
Open a fold
|
zA |
Toggle all folds
|
za |
Toggle single fold
|
zM |
Close ALL folds in buffer
|
:ls |
List all buffers
|
:bd |
Close the current buffer
|
:bd_n_ |
Close _n_ buffer
|
:bn |
Navigate to next buffer
|
:bp |
Navigate to previous buffer
|
Ctrl+c |
Close the current buffer
|
Ctrl+h |
Navigate to previous buffer
|
Ctrl+l |
Navigate to next buffer
|
Ctrl+ws |
Split current window horizontally
|
Ctrl+wv |
Split window vertically
|
Ctrl+wq |
Quit a window
|
|
Navigating Splits |
|
Ctrl+ww |
Move to next split
|
Ctrl+wh |
Move to split located LEFT of current
|
Ctrl+wl |
Move to split located RIGHT of current
|
Ctrl+wj |
Move to split located BELOW current
|
Ctrl+wk |
Move to split located ABOVE current
|
yy |
Yank (copy) a line
|
yw |
Yank (copy) a word
|
y$ |
Yank (copy) to end of line
|
p |
Paste BEFORE cursor
|
P |
Paste AFTER cursor
|
dd |
Delete (cut) a line
|
dw |
Delete (cut) a word
|
d$ |
Delete (cut) to end of line
|
x |
Delete (cut) single character
|
Ctrl+p |
Start Ctrl-P to search for files
|
<enter> |
Open file in new buffer
|
Ctrl+k |
Navigate UP in file list
|
Ctrl+j |
Navigate DOWN in file list
|
Ctrl+f |
Move FORWARD in search locations (files, buffers, most recent files)
|
Ctrl+b |
Move BACKWARD in search locations
|
v |
Open highlighted file in VERTICAL split
|
h |
Open highlighted file in HORIZONTAL split
|
<enter> |
Open highlighted file in new buffer
|
<leader>+a |
Open ack.vim for searching
|
q |
Close search results window
|
<Leader>+n |
Toggle NerdTree
|
P |
Move to ROOT of working directory
|
p |
Move to parent folder above cursor
|
<leader>+c<space> |
Toggle comment
|
<leader>+cl |
Line comment
|
<leader>+cu |
Uncomment
|
Ctrl+c |
Close the current buffer
|
Ctrl+h |
Navigate to previous buffer
|
Ctrl+l |
Navigate to next buffer
|
git mergetool from bash
:diffget lo |
Use local version
|
:diffget ba |
Use base version
|
:diffget re |
Use remote version
|
[c |
Navigate to PREVIOUS conflict
|
]c |
Navigate to NEXT conflict
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.