Show Menu
Cheatography

Vim Keyboard Shortcuts (DRAFT) by

Personnal vim cheat sheet

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

Git gutter

]c, [c
next, previous hunk
\hs, \hu
stage, undo hunk
\hp
preview hunk

Ack

?, q
help, close
o, O
open, open and close quickview
go
preview (focus on quickview)
t, T
new tab, new tab (keep focus)
h, H
hor. split, hor. split (keep focus)
v, gv
ver. split, ver. split (keep focus)

CtrlP

<F5>
Update cache
<C-­f>, <C-­b>
Cycle between modes
<C-­d>
Filename only
<C-­r>
Regex mode
<C-­t>, <C-­v>, <C-­x>
Open on tab, split

Lint

!python -m json.tool
Format json
Autopep8
Format python
Clang-­format
Format Clang

Syntastic

:Errors
Open error list
:lnext, :lprevious
Navigate through errors

Misc

C-r= <math expr.>
Calc. math expr. in Insert mode
C-o
Normal op. in insert mode

Caser

PascalCase
gsp or gsm
camelCase
gsc
snake_case
gss or gs_
UPPER_CASE
gsu or gsU
Title Case
gst
space case
gs<­spa­ce>
dash-case
gs-
dot.case
gs.

Marks

ma
set mark a at current cursor location
`.
jump to position where last change occurred in current buffer
`"
jump to position where last exited current buffer
`0
jump to position in last file edited (when exited Vim)
`1
like
`0
but the previous file (also
`2
etc)
''
jump back (to line in current buffer where jumped from)
`
`
jump back (to position in current buffer where jumped from)
`[
or
`]
jump to beginn­ing/end of previously changed or yanked text
`<
or
`>
jump to beginn­ing/end of last visual selection
 

Jedi

<C-­Spa­ce>
Completion
\g, \d
Goto assign­ment, definition
\r, \n
Usage, show all

Tags

Ctrl-]
Go to definition
g]
List of matches
Ctrl-w Ctrl-]
Definition in hsplit
Ctrl-t
Jump back up in the tag stack

Easy align

ga
Easy align
=, 2=, *=, -=
1st occurr­ence, 2nd, all, last
gaip*|
Align table

Comments

\cc, \cu, \c<­spa­ce>
Comment, Uncomment, Toggle
\cs, \cb
Sexy comment, block

Docume­ntation

C-l
Python docstring

NerdTree

F8
Toggle
go
preview
i, gi, s, gs
split, vsplit
K, J
Go to first/last child

fold

zc, zo, za
close, open, toggle
zC, zO, zA
idem for all levels
zM, zR
close, open all
zr
open one level

Spell

z=
Show sugges­tions
zg
Add to dict

Intere­sting words

Highlight
<Le­ade­r>k
Navigate
n and N
Clear
<Le­ade­r>K
 

Search

flags: [g], [c], [i], [I]
All occurr­ences, confir­mation, ignore case, don't ignore case
:%s, :1,10s
Whole doc, line 1 to 10
\<f­oo\>
Whole word
:g/^ba­z/s­/fo­o/bar/g
Change each 'foo' to 'bar' in each line starting with 'baz'
:g/foo/d
Delete all lines matching foo (g! for not matching)
\zs, \ze
Start, end of a pattern

Format

V=
select text, then reformat with =
=
will correct alignment of code
==
one line;
gq
reformat paragraph

Matching

Substitute

Registers

"ay
Yank to register a
"ap
Paste register a
Ctrl-r + <re­gis­ter>
Insert content of <re­gis­ter>
"., "%, ":, "#
Last inserted text, current filepath, last executed command, last alternate file name
"=, Ctrl-r + =
Result of expression
/, ?, * or #
Search registers