Show Menu
Cheatography

Vim Bernat Keyboard Shortcuts (DRAFT) by

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

Ruby/R­ail­s/Tools

Open model
foo
:Emodel foo
Open controller
foo
:ECont­roller foo
Open model
foo
in hsplit
:Smodel foo
Open controller
foo
in vsplit
:Vcont­roller foo
Open alternate file
:A
Open related file
:R
Open Rails console
:Rails console
Run current spec file
,t
Run nearest spec
,s
Run last spec
,l
Git blame
:Gblame

File Navigation

NERDTree
F5
Open
o
Open in vsplit
s
Open in hsplit
i
Find file in tree
,v
Toggle hidden files
I
Modify node
m
Find fuzzy file
,cp
ctrlp Open in vsplit
Ctrl+V
ctrlp Open in hsplit
CTRL+X
Search string
:Ack! s
Open
o
Open in vsplit
v
Open in hsplit
h
Edit previous buffer
,z
Edit next buffer
,x
Swap between last edited buffers
,,
 

Text manipu­lation

Interp­olate Ruby String
,#
Surround with "
,"
Surround wuth '
,'
Surround with ()
,(
Surround with []
,[
Surround with {}
,{
Change inside "­"
ci"
Change inside ()
ci(
Change inside {}
ci{
Change inside []
ci[
Replace line from cursor
C
Insert at end of line
A
Insert at beginning of line
I
Insert line below cursor
o
Insert line above cursor
O
Join line with below
J
Change delimiter quotes from " to '
cs"'
Delete delimiter quotes
ds"
Comment out a line
gcc
Comment a selection
gc

Motion

Yank inside delimiter (e.g. {})
yi{
Yank around delimiter (e.g. {})
ya{
Mark position as 'a'
ma
Yank to mark 'a'
y'a
Yank inner method
yim
Yank around method
yam
 

Code navigation

Go to method definition
,f
Go to method definition in a vsplit
,F
Go to matching brace
%
Auto Complete
Ctrl+N
First character of line
0
End of line
$
Word Forward
w
Word Backward
b
Page forward
Ctrl+f
Page backwards
Ctrl+b
Next/P­revious method
]m / [m
End of method definition
]M / [M
Next/P­revious class/­module
]] / [[

Search and replace

Search forward
/<p­att­ern>
Search backwards
?<p­att­ern>
Jump to next match
n
Jump to previous match
N
Replace
old
with
new
in
range
:<r­ang­e>s­/<o­ld>­/<n­ew>­/[g­,i,I,c]
Search forward for word under cursor
*
Search backward for word under cursor
#
Grep word under cursor
K
Remove search highlight
//

Misc

New vsplit
vv
New hsplit
ss
Move to split
Ctrl+W­,l/­r/u/d
Undo
u
Redo
Ctrl+r
Repeat
.
List buffers
:ls