Show Menu
Cheatography

Vim Keyboard Shortcuts (DRAFT) by

Personal list of vim commands, because I keep forgetting until I just don't anymore

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Utils

:diffthis
Diff buff
:diffoff
Stop Diff
:find
Search files
:ls
List buffers
:b [buffe­r_name]
Open buffer
:set spell spelll­ang­=en_us
Spell checking
:setlocal spell spelll­ang­=en_us
Spell checking for local buffer
:set nospell
Disable spell checking
:s /[patt­ern­]/­\r&/g
\r -> add jumps of lines to matching pattern.
ctrl + w =
Equalize sizes of tabs
ctrl + w H
Change H splits to V
ctrl + w K
Change V splits to H
:[S/V]ex
Open native file explorer [H split/V split]
:terminal :term
Open terminal in a new buffer, use ++curwin to open in the current buffer
ctrl + w shift + n
When in a terminal window, make the buffer work as a regular buffer, a to go back to terminal

Movement

[N]G
Jump to line N
H M L
Jump to the top/mi­ddl­e/b­ottom of the screen
''
Jump to last position in buffer
ma
Add tag 'a' to buffer
'a
Jump to tag 'a'
f[]
Find forward in line
F[]
Find backwards in line
t[]
Find forward in line and leave cursor before[]
T[]
Find backwards in line and leave cursor before[]
;/,
When using f/F, t/T go to next or prev
 

Search

:[rang­e]g­/pa­tte­rn/cmd
Delete lines that match pattern
:[rang­e]g­!/p­att­ern/cmd
Delete lines that not matching pattern
:<,­'> g/int/d - delete all lines containing int

C tags

ctrl ]
Jump to definition
ctrl g]
Global list of matching tags
ctrl t
Jump to previous tag

Format

=%
Format to end of method
gg=G
From gg reformat (=) file to G

Tabs

tabnew
Opens new tab
tab ter
Opens terminal in new tab
g t
Next tab
g T
Previous tab
nnnn g t
Numbered tab
 

Text

~
Switch case
xp
Swap current char with next
Xp
Swap current char with prev.
yaw
Copy word under cursor.
daw
Delete word under cursor.
ce
Delete word from cursor and insert
caw
Delete word under cursor and insert.
cc
Delete current line and insert.
c$
Delete line and i
ci"
Change inside "
ca"
Change all "­".
x
Delete char under cursor.
<C-­a>
Increment number under cursor
<C-­x>
Decrement number under cursor
g<C­-a/­x>
Inc/Dec sequen­tially
I
Insert at the beginning of the line