-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathvim-custom-cheatsheet.txt
220 lines (195 loc) · 5.15 KB
/
vim-custom-cheatsheet.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
Vim Cheat Sheet
===============
Cheat sheet for my custom (and some standard) Vim commands.
Navigation
----------
% Match x
* Next occurrence
# Previous occurrence of text
g* Next occurrence (part of text)
g# Previous occurrence (part of text)
gd Go to definition (local scope)
gD Go to definition (global scope)
g, Go forward to latest edit
g; Go backward to latest edit
gg Go to top of buffer
G Go to bottom of buffer
[ Go to next method/section/paragraph
{ Go to next method/section/paragraph
( Go to next method/section/paragraph
S Replace line
s Replace char
. Repeat latest edit
Buffers
-------
,mr List of most recently used files
,t Fuzzy find file
C-w o Maximize buffer
C-tab Next buffer
C-S-tab Previous buffer
,bn Next buffer
,bp Previous buffer
,bc Close buffer
,ba Close all buffers
Windows
-------
C-w C-w Go to next window
C-l Go to right window
C-h Go to left window
C-j Go to upper window
C-k Go to lower window
Fugitive
--------
:Gcommit
:Gread
:Gwrite
:Gblame
:Gbrowse
:Gmove
:Gremove
:Gdiff
:Gstatus
:Ggrep
:Gsplit | Gvsplit
:Git
Fuzzy Finder
-----------
,t Find file recursively from CWD
,b :FufBuffer
,f :FufFile
,l :FufLine
,mr :FufMruFile
,dd :FufDir
,dr :FufDirWithFullCwd
,dc :FufDirWithCurrentBufferDir
Session
-------
:SaveSession <tab> Save session
:OpenSession <tab> Load session
:ViewSession View session
:CloseSession Close session
Registers
---------
“a y Yank into register a (replace)
“A y Yank into register A (append)
“a p Paste from register a
:registers Show all registers
Marks
-----
m<register> Set bookmark
'<register> Go to bookmark
:marks Show bookmarks
:delmarks a b c Delete marks a b c
:delmarks! Delet all marks
Tags
----
:tags Show all tags
C-] Go to next tag
C-t Go to previous tag
NERDTree
--------
,nt Toggle NERDTree
B Show bookmarks
C Set dir as top dir
cd Set dir as working dir
O Open file/folder
m Show menu
NERDCommmenter
--------------
,cc Comment out current line or selected lines in visual mode
,cn Same as ,cc but forces nesting
,c <space> Toggles the comment state of the selected line(s)
,cs Comments out the selected lines ‘sexily’
‘cu Uncomments the selected line(s).
LustyJuggler
------------
,lj (Quick) jump to open buffer (LustyJuggler)
,lf Opens the filesystem explorer.
,lr Opens the filesystem explorer from directory of the current file.
,lb Opens the buffer explorer
,lg Opens the buffer grep, for searching through all loaded buffers
Yank Ring
---------
,yr Opens list of yank ring
C-P Moves backward through the yank ring (after an initial paste)
C-N Moves forward through the yank ring (after an initial paste)
Surround
--------
ds” Delete surrounding “
cs{( Change surrounding { to (
ysiw( Wrap word in (
yss{ Wrap line in {
Compiling
---------
C-B Build
C-L Show error list
,cc Show cope (error list)
,n Jump to next error
,p Jump to previous error
Misc
----
,cd Set current file dir to current dir
gq<move> Format section over ‘movement’
,w Save buffer
gg=G Format the whole buffer
=i{ Format all within the {..} block
,e Edit vimrc
,t2 Set shiftwidth to 2 (t2 or t4)
,q Open scratchpad
,wm Remove Windows ^M
Grep/Search
----
:Ack ... Search with ack
space Search backwards
C-space Search forwards
,g Vimgrep
:vimgrep /pattern/[j][g] filepattern (use j for listing in quicklist)
Undo branching
--------------
g- Traverse all undos backwards
g+ Traverse all undos forwards
:undolist List all undo branches
:undo N Undo to number N in list
:earlier Ns
:earlier Nm
:earlier Nh
:later Ns
:later Nm
:later Nh
Spelling
--------
,ss Toggle spelling
,sn Next error
‘sp Previous error
Folding
-------
zc Close fold
zo Open fold
zM Close all folds
zR Open all folds
za Toggle fold
‘z Toggle fold
RestructuredText
----------------
h1..h5 Create reST style headings
:Vstm Open menu
:Vst head Show heading styles
:Vst doc Show table of contents
:Vst link Show all links
:Vst pdf|html|xml|latex Convert to X
ConqueTerm
----------
:ConqueTerm zsh Opens a terminal
:ConqueTermSplit zsh Opens a terminal in horizontal split
:ConqueTermVSplit zsh Opens a terminal in vertical split
Remote
------
:Nread remote.server.com jboner PASSWD path
:Nwrite remote.server.com jboner PASSWD path
vim ftp://...
Diff
----
vim -d f1 f2 Diff files
:diffsplit file Diff with horizontal split
:vert diffsplit f1 Diff with vertical split
:set scrollbind Set windows to be in sync