Show Menu
Cheatography

VIM Keyboard Shortcuts (DRAFT) by

VIM Shortcuts Mapping

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

Editor Config

F2
pastet­oggle
toggle paste mode
[leader] ;
:set list!
toggle whitespace characters
[leader] nu
:set nu!
toggle line numbers
[leader] rnu
:set rnu!
toggle rel. line numbers
[leader] h
:noh
disable hl till next search

Navigation

[ctrl]­{h,­j,k,l}
 
move around buffers
{ | }
 
next | previous blank line

Buffers

gb
:bn
next buffer
gB
:bp
previous buffer
[leader] bd
:bd
close buffer
[leader] df
:w !diff %
diff since last write

Insert Mode Shortcuts

[ctrl] a
0
to line beginning
[ctrl] e
$
to line end
[ctrl] u
ddi
change entire line

lion.vim

gl|gL [motio­n][­char]
spaces left | right to align
glip=
align '=' till blank line
gLi(,
align ',' within (

vim-su­rround

cs [target] [repla­cement]
replace surround
ds [target]
remove surround
ysiw [surround]
surround word
yss [surround]
surround line
Tags
use
<ta­g>
e.g.
<di­v>
for replac­ement
use
t for target

target­s.vim

ci [target]
change in target from cursor
cI [target]
change inside target
ca [target]
change include target
cA [target]
change around outside of target
Pairs:
[ ], { }, ( ), < >,  t for tags e.g <di­v>

Quotes:
' " `

Separator:
, . ; : + - = ~ _ * # / | \ & $

Arguments:
a
(text surrounded by braces and commas)

vim-co­mme­ntary

gc[motion]
comment out using motion
gcc
comment out a line
gcap
comment out paragraph
:7,17C­omm­entary
comment out a range

Replace

[leader]\w
 
replace word under cursor
[leader]\h
:%s//
replace last search
[leader]\r
:%s/
replace

Ferret

[ctrl] q
:cclose
close quick fix
[ctrl] a
:Ack
find in CWD
[ctrl] af
:Back
find in buffer
[ctrl] s
:Ack
find word under cursor in CWD
[ctrl] sf
:Back
find word under cursor in buffer
[ctrl] r
 
replace results in quick fix

NerdTree

[ctrl] f
:NERDT­ree­Toggle
toggles NERDTree
[ctrl] t
:NERDT­ree­Focus
moves focus to NERDTree
go
 
open (focus in NerdTree)
t | T
 
open [silently] in new tab
i | gi
 
open [preview] h-split
s | gs
 
open [preview] v-split
cd
 
move CWD to folder
CD
 
move root to CWD folder
r | R
 
refresh folder | root
I
 
toggle hidden files

Vifm

[leader] f
:Vifm
open buffer using vifm
[leader] fv
:Vspli­tVifm
open split using vifm
[leader] ft
:TabVifm
open tab using vifm

CtrlP

[ctrl] n
:CtrlP
run CtrlP
[ctrl] f | b
 
next | previous mode

ALE Linter

[leader] lf
:ALEFix
auto-fix linter issues
[leader] l
:ALEToggle
toggle ALE Gutter

vim-gi­tgutter

[leader]gg
:GitGu­tte­rToggle
toggle the gutter
]c | [c
 
next | previous hunk
[leader]hs
 
stage hunk
[leader]hu
 
undo hunk
[leader]hp
 
preview hunk
[leader]hP
 
close preview

fugitive

:G
:Git
git alias
[leader]gd
:Git diff
open git diff in file
[leade­r]gds
:Gdiff­split
open diff side-b­y-side