4 <h1><a name=
"vim_commands" id=
"vim_commands">Vim Commands
</a></h1>
8 <th class=
"col0 leftalign" colspan=
"2"> Vim Modes
</th>
11 <td class=
"col0 leftalign"> insert
</td><td class=
"col1"> when inserting or replacing text
</td>
14 <td class=
"col0 leftalign"> normal
</td><td class=
"col1"> after pressing escape
</td>
17 <td class=
"col0"> command
</td><td class=
"col1"> after pressing : on normal mode
</td>
20 <td class=
"col0"> operator pending
</td><td class=
"col1 leftalign"> after a command that needs an operator (e.g. :d)
</td>
23 <td class=
"col0 leftalign"> visual
</td><td class=
"col1"> after pressing v, V or Ctrl+V on normal mode
</td>
26 <th class=
"col0" colspan=
"2"> Miscelaneous
</th>
29 <td class=
"col0"> :set fileencoding=utf8
</td><td class=
"col1"> change file encoding
</td>
34 <!-- SECTION "Vim Commands" [1-377] -->
35 <h3><a name=
"motion" id=
"motion">Motion
</a></h3>
37 <table class=
"inline">
39 <th class=
"col0" colspan=
"2"> Operators
</th>
42 <td class=
"col0"> c
</td><td class=
"col1"> change
</td>
45 <td class=
"col0"> d
</td><td class=
"col1"> delete
</td>
48 <td class=
"col0"> y
</td><td class=
"col1"> yank
</td>
51 <td class=
"col0"> ~
</td><td class=
"col1"> swap case
</td>
54 <td class=
"col0"> g~
</td><td class=
"col1"> swap case
</td>
57 <td class=
"col0"> g[uU]
</td><td class=
"col1"> make lowercase/uppercase
</td>
60 <td class=
"col0"> !
</td><td class=
"col1"> filter through external program
</td>
63 <td class=
"col0"> =
</td><td class=
"col1"> indent
</td>
66 <td class=
"col0"> g?
</td><td class=
"col1"> ROT13 encoding
</td>
69 <td class=
"col0"> [
><]
</td><td class=
"col1"> shift right/left
</td>
72 <td class=
"col0"> zf
</td><td class=
"col1"> define a fold
</td>
75 <th class=
"col0" colspan=
"2"> Left-Right
</th>
78 <td class=
"col0"> [hl]
</td><td class=
"col1"> left/right
</td>
81 <td class=
"col0"> [
0$]
</td><td class=
"col1"> beginning/end of line
</td>
84 <td class=
"col0"> [^|g_]
</td><td class=
"col1"> first/last non-blank of line
</td>
87 <td class=
"col0"> [g0|g$]
</td><td class=
"col1"> beginning/end of screen line
</td>
90 <td class=
"col0"> g^
</td><td class=
"col1"> first non-blank of screen line
</td>
93 <td class=
"col0"> |
</td><td class=
"col1"> go to column
</td>
96 <td class=
"col0"> f
<char
> </td><td class=
"col1"> find
<char
> </td>
99 <td class=
"col0"> F
<char
> </td><td class=
"col1"> find reverse
<char
> </td>
102 <td class=
"col0"> t
<char
> </td><td class=
"col1"> till
<char
> </td>
105 <td class=
"col0"> T
<char
> </td><td class=
"col1"> till reverse
<char
> </td>
108 <td class=
"col0"> ;
</td><td class=
"col1"> repeat last [fFtT]
</td>
111 <td class=
"col0"> ,
</td><td class=
"col1"> repeat reverse last [fFtT]
</td>
114 <th class=
"col0" colspan=
"2"> Up-Down
</th>
117 <td class=
"col0"> [kj]
</td><td class=
"col1"> up/down
</td>
120 <td class=
"col0"> [gk|gj]
</td><td class=
"col1"> up/down screen line
</td>
123 <td class=
"col0"> [-+]
</td><td class=
"col1"> same as [kj]^
</td>
126 <td class=
"col0"> G
</td><td class=
"col1"> go to line
</td>
129 <th class=
"col0" colspan=
"2"> Word
</th>
132 <td class=
"col0"> w
</td><td class=
"col1"> next word
</td>
135 <td class=
"col0"> W
</td><td class=
"col1"> next WORD (space delimited word)
</td>
138 <td class=
"col0"> [eE]
</td><td class=
"col1"> next end of word/WORD
</td>
141 <td class=
"col0"> [bB]
</td><td class=
"col1"> previous (beginning of) word/WORD
</td>
144 <td class=
"col0"> [ge|gE]
</td><td class=
"col1"> previous end of word/WORD
</td>
147 <th class=
"col0" colspan=
"2"> Text Object
</th>
150 <td class=
"col0"> (
</td><td class=
"col1"> previous sentence
</td>
153 <td class=
"col0"> )
</td><td class=
"col1"> next sentence
</td>
156 <td class=
"col0"> {
</td><td class=
"col1"> previous paragraph
</td>
159 <td class=
"col0"> }
</td><td class=
"col1"> next paragraph
</td>
162 <td class=
"col0"> ]]
</td><td class=
"col1"> next { in the first column
</td>
165 <td class=
"col0"> ][
</td><td class=
"col1"> next } in the first column
</td>
168 <td class=
"col0"> [[
</td><td class=
"col1"> previous { in the first column
</td>
171 <td class=
"col0"> []
</td><td class=
"col1"> previous } in the first column
</td>
174 <th class=
"col0" colspan=
"2"> Text Object Selection
</th>
177 <td class=
"col0"> [ai][wWsp]
</td><td class=
"col1"> a/inner word/WORD/sentence/paragraph
</td>
180 <td class=
"col0"> a[ or a]
</td><td class=
"col1"> a [] block
</td>
183 <td class=
"col0"> i[ or i]
</td><td class=
"col1"> inner [] block
</td>
186 <td class=
"col0"> [ai][()b]
</td><td class=
"col1"> a/inner () block
</td>
189 <td class=
"col0"> [ai][
<>]
</td><td class=
"col1"> a/inner
<> block
</td>
192 <td class=
"col0"> [ai]t
</td><td class=
"col1"> a/inner tag block
</td>
195 <td class=
"col0"> [ai][{}B]
</td><td class=
"col1"> a/inner {} block
</td>
198 <td class=
"col0"> [ai][”
'`]
</td><td class=
"col1"> a/inner quoted string
</td>
201 <th class=
"col0" colspan=
"2"> Others
</th>
204 <td class=
"col0"> %
</td><td class=
"col1"> next ([{}]), #if, #ifdef, #else, #elif, #endif
</td>
207 <td class=
"col0"> ])
</td><td class=
"col1"> next unmatched )
</td>
210 <td class=
"col0"> ]}
</td><td class=
"col1"> next unmatched }
</td>
213 <td class=
"col0"> [(
</td><td class=
"col1"> previous unmatched (
</td>
216 <td class=
"col0"> [{
</td><td class=
"col1"> previous unmatched {
</td>
219 <td class=
"col0"> ]m
</td><td class=
"col1"> next start of method
</td>
222 <td class=
"col0"> ]M
</td><td class=
"col1"> next end of method
</td>
225 <td class=
"col0"> [m
</td><td class=
"col1"> previous start of method
</td>
228 <td class=
"col0"> [M
</td><td class=
"col1"> previous end of method
</td>
231 <td class=
"col0"> ]#
</td><td class=
"col1"> next unmatched #else or #endif
</td>
234 <td class=
"col0"> [#
</td><td class=
"col1"> previous unmatched #else or #endif
</td>
237 <td class=
"col0"> ]* or ]/
</td><td class=
"col1"> next end of a C comment “*/”
</td>
240 <td class=
"col0"> [* or [/
</td><td class=
"col1"> previous start of a C comment ”/*”
</td>
243 <td class=
"col0"> [HML]
</td><td class=
"col1"> top/middle/botton of window
</td>
248 <!-- SECTION "Motion" [378-2477] -->
249 <h3><a name=
"map" id=
"map">Map
</a></h3>
251 <table class=
"inline">
253 <th class=
"col0 leftalign" colspan=
"2"> Types
</th>
256 <td class=
"col0 leftalign"> :map
</td><td class=
"col1"> normal, visual or operator pendind mode
</td>
259 <td class=
"col0 leftalign"> :map!
</td><td class=
"col1"> insert or command mode
</td>
262 <th class=
"col0 leftalign" colspan=
"2"> Example
</th>
265 <td class=
"col0" rowspan=
"2"> :map!
<C-s
> <Esc
>:w
<CR
> </td><td class=
"col1"> maps Ctrl+S to “escape :w enter”
</td>
268 <td class=
"col0">on insert or command mode
</td>
273 <!-- SECTION "Map" [2478-2743] -->
274 <h3><a name=
"abreviation" id=
"abreviation">Abreviation
</a></h3>
276 <table class=
"inline">
278 <th class=
"col0" colspan=
"2"> Types
</th>
281 <td class=
"col0 leftalign"> :ab(breviate)
</td><td class=
"col1 leftalign"> insert and command mode
</td>
284 <td class=
"col0"> :iab(brev)
</td><td class=
"col1"> insert mode
</td>
287 <td class=
"col0"> :cab(brev)
</td><td class=
"col1"> command mode
</td>
290 <th class=
"col0" colspan=
"2"> Example
</th>
293 <td class=
"col0" rowspan=
"2"> :iab #i #include
</td><td class=
"col1"> changes #i
<Space
> to #include
</td>
296 <td class=
"col0"> on insert mode
</td>
301 <!-- SECTION "Abreviation" [2744-2987] -->
302 <h3><a name=
"window_management" id=
"window_management">Window Management
</a></h3>
304 <table class=
"inline">
306 <th class=
"col0" colspan=
"2"> Creation
</th>
309 <td class=
"col0"> vim -o
</td><td class=
"col1"> open each file in a separate window
</td>
312 <td class=
"col0"> :sp(lit) or Ctrl+W,S
</td><td class=
"col1"> split current horizontally
</td>
315 <td class=
"col0"> :vs(plit) or Ctrl+W,V
</td><td class=
"col1"> split current vertically
</td>
318 <td class=
"col0"> :new or Ctrl+W,N
</td><td class=
"col1"> open new horizontally
</td>
321 <td class=
"col0"> :vne(w)
</td><td class=
"col1"> open new vertically
</td>
324 <th class=
"col0" colspan=
"2"> Navigation
</th>
327 <td class=
"col0"> Ctrl+W,W or Ctrl+(W,W)
</td><td class=
"col1"> iterate through windows
</td>
330 <td class=
"col0"> Ctrl+W,[HJKL]
</td><td class=
"col1"> go to windows on left, down, up, right
</td>
333 <th class=
"col0" colspan=
"2"> Resizing
</th>
336 <td class=
"col0"> Ctrl+W,=
</td><td class=
"col1"> make all windows equally big
</td>
339 <td class=
"col0"> :res[ize] -N or Ctrl+W,-
</td><td class=
"col1"> decrease height
</td>
342 <td class=
"col0"> :res[ize] +N or Ctrl+W,+
</td><td class=
"col1"> increase height
</td>
345 <td class=
"col0"> :res[size] [N] or Ctrl+W,_
</td><td class=
"col1"> set window height
</td>
348 <td class=
"col0"> Ctrl+W,
< </td><td class=
"col1"> decrease width
</td>
351 <td class=
"col0"> Ctrl+W,
> </td><td class=
"col1"> increase width
</td>
354 <td class=
"col0"> Ctrl+W,|
</td><td class=
"col1"> set width
</td>
357 <th class=
"col0" colspan=
"2"> Destruction
</th>
360 <td class=
"col0"> Ctrl+W,C
</td><td class=
"col1"> close window
</td>
363 <td class=
"col0"> Ctrl+W,O
</td><td class=
"col1"> close all other windows
</td>
368 <!-- SECTION "Window Management" [2988-3770] -->
369 <h3><a name=
"buffer_management" id=
"buffer_management">Buffer Management
</a></h3>
371 <table class=
"inline">
373 <th class=
"col0" colspan=
"2"> Creation
</th>
376 <td class=
"col0"> :e(dit)
<name
> </td><td class=
"col1"> open buffer
</td>
379 <th class=
"col0" colspan=
"2"> Navigation
</th>
382 <td class=
"col0"> :b(uffer)
<num
> </td><td class=
"col1"> switch to buffer
<num
> </td>
385 <td class=
"col0"> :sb(uffer)
<num
> </td><td class=
"col1"> split windows and switch to buffer
<num
> </td>
388 <th class=
"col0" colspan=
"2"> Status
</th>
391 <td class=
"col0"> :ls or :buffers or :files
</td><td class=
"col1"> list buffers
</td>
394 <th class=
"col0" colspan=
"2"> Command Execution
</th>
397 <td class=
"col0"> :buffdo
</td><td class=
"col1"> execute command on each buffer
</td>
400 <th class=
"col0" colspan=
"2"> Destruction
</th>
403 <td class=
"col0"> :bd(elete)
</td><td class=
"col1"> unload buffer
</td>
406 <td class=
"col0"> :bw(ipeout)
</td><td class=
"col1"> unload and delete buffer
</td>
411 <!-- SECTION "Buffer Management" [3771-4188] -->
412 <h3><a name=
"tab_management" id=
"tab_management">Tab Management
</a></h3>
414 <table class=
"inline">
416 <th class=
"col0" colspan=
"2"> Creation
</th>
419 <td class=
"col0"> vim -p
</td><td class=
"col1"> open each file in a separate tab
</td>
422 <td class=
"col0"> :tabe(dit)
</td><td class=
"col1"> open tab
</td>
425 <td class=
"col0"> Ctrl+W,Shift+T
</td><td class=
"col1"> open current window in a new tab
</td>
428 <td class=
"col0"> Ctrl+W,GF
</td><td class=
"col1"> open filename under cursor in new tab
</td>
431 <th class=
"col0" colspan=
"2"> Navigation
</th>
434 <td class=
"col0"> :tabn(ext) or gt
</td><td class=
"col1"> go to next tab
</td>
437 <td class=
"col0"> :tabp(revious) or gT
</td><td class=
"col1"> go to previous tab
</td>
440 <th class=
"col0" colspan=
"2"> Organization
</th>
443 <td class=
"col0"> :tabm(ove)
<num
> </td><td class=
"col1"> move to after tab page
<num
> </td>
446 <th class=
"col0" colspan=
"2"> Status
</th>
449 <td class=
"col0"> :tabs
</td><td class=
"col1"> list tabs
</td>
452 <th class=
"col0" colspan=
"2"> Command Execution
</th>
455 <td class=
"col0"> :tabdo
</td><td class=
"col1"> execute command on each tab
</td>
458 <th class=
"col0" colspan=
"2"> Destruction
</th>
461 <td class=
"col0"> :tabc(lose)
</td><td class=
"col1"> close tab
</td>
464 <td class=
"col0"> :tabo(nly)
</td><td class=
"col1"> close all other tabs
</td>
469 <!-- SECTION "Tab Management" [4189-4760] -->
470 <h3><a name=
"tags" id=
"tags">Tags
</a></h3>
475 Use
<a href=
"http://ctags.sourceforge.net/" class=
"urlextern" title=
"http://ctags.sourceforge.net/" rel=
"nofollow">ctags
</a> to generate the tags file.
478 <table class=
"inline">
480 <th class=
"col0" colspan=
"2"> Navigation
</th>
483 <td class=
"col0"> :ta(g)
</td><td class=
"col1"> jump to tag
</td>
486 <td class=
"col0"> Ctrl+]
</td><td class=
"col1"> jump to tag under cursor
</td>
489 <td class=
"col0"> Ctrl+W ]
</td><td class=
"col1"> split window and go to tag under cursor
</td>
492 <td class=
"col0"> Ctrl+W }
</td><td class=
"col1"> show tag under cursor in preview window
</td>
495 <td class=
"col0"> :pta(g)
</td><td class=
"col1"> show tag in preview window
</td>
498 <td class=
"col0"> Ctrl+T
</td><td class=
"col1"> jump back
</td>
501 <td class=
"col0"> :ts(elect)
</td><td class=
"col1"> list tags that match
</td>
504 <td class=
"col0"> :tj(ump)
</td><td class=
"col1"> :ts that jumps directly when possible
</td>
507 <td class=
"col0"> :sts(elect)
</td><td class=
"col1"> :tselect and split
</td>
510 <td class=
"col0"> g]
</td><td class=
"col1"> Ctrl+] with :tselect
</td>
513 <td class=
"col0"> :tn(ext)
</td><td class=
"col1"> next matching tag
</td>
516 <td class=
"col0"> :tp(revious)
</td><td class=
"col1"> previous matching tag
</td>
519 <td class=
"col0"> :p*
</td><td class=
"col1"> same with preview window
</td>
522 <th class=
"col0" colspan=
"2"> Status
</th>
525 <td class=
"col0"> :tags
</td><td class=
"col1"> list tag stack
</td>
528 <th class=
"col0" colspan=
"2"> Destruction
</th>
531 <td class=
"col0"> :pc(lose) or Ctrl+W,Z
</td><td class=
"col1"> close preview window
</td>
536 <!-- SECTION "Tags" [4761-5474] -->
537 <h3><a name=
"change_list" id=
"change_list">Change List
</a></h3>
539 <table class=
"inline">
541 <th class=
"col0" colspan=
"2"> Navigation
</th>
544 <td class=
"col0"> g;
</td><td class=
"col1"> go to previous change
</td>
547 <td class=
"col0"> g,
</td><td class=
"col1"> go to next change
</td>
550 <th class=
"col0" colspan=
"2"> Status
</th>
553 <td class=
"col0"> :changes
</td><td class=
"col1"> list changes
</td>
558 <!-- SECTION "Change List" [5475-5612] -->
559 <h3><a name=
"marks" id=
"marks">Marks
</a></h3>
561 <table class=
"inline">
563 <th class=
"col0" colspan=
"2"> Definition
</th>
566 <td class=
"col0"> m
<char
> </td><td class=
"col1"> set mark
</td>
569 <th class=
"col0" colspan=
"2"> Navigation
</th>
572 <td class=
"col0"> [
'`]
<char
> </td><td class=
"col1"> jump to line/position of mark
</td>
575 <td class=
"col0"> ]
' </td><td class=
"col1"> jump to line next mark
</td>
578 <td class=
"col0"> ]`
</td><td class=
"col1"> jump to position next mark
</td>
581 <td class=
"col0"> [
' </td><td class=
"col1"> jump to line previous mark
</td>
584 <td class=
"col0"> [`
</td><td class=
"col1"> jump to position previous mark
</td>
587 <th class=
"col0" colspan=
"2"> Status
</th>
590 <td class=
"col0"> :marks
</td><td class=
"col1"> list the marks
</td>
595 <!-- SECTION "Marks" [5613-5916] -->
596 <h3><a name=
"jumps" id=
"jumps">Jumps
</a></h3>
598 <table class=
"inline">
600 <th class=
"col0" colspan=
"2"> Navigation
</th>
603 <td class=
"col0"> Ctrl+O
</td><td class=
"col1"> go to previous jump position
</td>
606 <td class=
"col0"> Ctrl+I or
<Tab
> </td><td class=
"col1"> go to next jump position
</td>
609 <th class=
"col0" colspan=
"2"> Status
</th>
612 <td class=
"col0"> :jumps
</td><td class=
"col1"> list jumps
</td>
617 <!-- SECTION "Jumps" [5917-] -->