You are on page 1of 2

The Vim Alphabetic Reference Card ----------------------------------------------------------------- A append at the end of the line (maps, menus) in Select mode

[d display 1st macro definition that contains ^a add [count] to the number at or after the g] :tselect on tag under cursor
of Commonly Used Commands macro under cursor cursor g^ wrap off: goto leftmost non-white
Based on a list compiled by Charles E Campbell,
[D display all macro definition that contain b beginning of previous word onscreen char on current line
Jr.,12/99. Updated by Alan E Klietz 5/2005.
macro under cursor B beginning of previous word, ignore ga print ascii value of character under cursor
Important/frequently used commands are boxed.
[^D jump to 1st macro definition that contains punctuation gd goto definition of word under cursor in
----------------------------------------------------------------- keyword under cursor ^b scroll back one screen; see ^f current function
Command line options: ][ go forwards count sections to to next '}' ---------------------------------------------------------------- ---------------------------------------------------------------
-b binary mode in 1st column c delete {motion} text (into register) and ge go backwards to end of previous word
-n no swap file; use memory only ]] next section begin insert gf start editing file whose name is under
-r recover aborted session via swap file ---------------------------------------------------------------- C change to end of line cursor
-R readonly mode ]} goto next unmatched '}' ^c ends insert mode, unused in command gg cursor to line N (default: 1) ; start Select
-V[N] verbose mode (to troubleshoot .vim scripts) ]# goto next unmatched "#if" or "#else" mode mode
----------------------------------------------------------------- ]* goto next end of a C comment (*/) d{motion} delete text covered by a {motion} gh start Select mode
: enter Command Mode like '[i', but start at current cursor position
]i d’a delete up to mark gj wrap on: like "j", but go N screen lines
Esc return to Normal Mode ]I like '[I', but start at current cursor position Ndd delete N lines down
. repeat the last command ---------------------------------------------------------------- D delete to end of line ---------------------------------------------------------------
---------------------------------------------------------------- ^] jump to file having tag under cursor. See ^t ^d scroll down half a window (N^d sets new gk wrap on: like "k", but go N screen lines up
% jump to matching parenthesis, brace, or ---------------------------------------------------------------- default); see ^u gm goto character at middle of screenline
bracket ]^I like '[^I', but start at current cursor ---------------------------------------------------------------- go cursor to byte N in buffer
'a jump to line with mark a. See m. position e end of word ["x]gp put text (from register x) after
( jump to previous sentence ]d like '[d', but start at current cursor position E end of word, ignore punctuation cursor N times
) jump to next sentence ]D like '[D', but start at current cursor ^e scroll screen down one line gq{motion} format text
----------------------------------------------------------------- position --------------------------------------------------------------- gr{char} virtual replace N chars with given
0 goto beginning of line ^ first non-whitespace character fx find given character forwards char
$ goto end of line _ move (count-1) lines downward on first F find given character backwards gs goto sleep for N (1) seconds
+ goto first character of next line non-blank character ^f scroll forward one screen; see ^b gu{motion} make Nmove text lowercase
, reverse direction of last f, F, t, or T ---------------------------------------------------------------- --------------------------------------------------------------- gv reselect previous Visual area
- goto first character of previous line ` goto mark g ^g show information about current cursor g~{motion} swap case for Nmove text
/<text> search forward for text, / to repeat { previous paragraph position ---------------------------------------------------------------
?<text> search backward text, ? to repeat | to screen column [count] in current line g ^h start Select block mode g<Down> same as gj
* search for word under cursor N times } next paragraph g ^] :tjump to tag under the cursor g<End> same as g$
# same as *, but search backwards ~ switch case of current character g# like "#", but without using "\<" and "\>" g<Home> same as g0
& synonym for ":s//~/" (repeat last substitution) ---------------------------------------------------------------- g$ wrap off: goto rightmost onscreen g<LeftMouse> same as <ctrl-LeftMouse>
'' go to start of line of previous mark or character of current line g<RightMouse> same as <ctrl-
-----------------------------------------------------------------
location before search g* like "*", but without using "\<" and "\>" RightMouse>
; repeat last f, F, t, or T
`` return to previous mark or location before g0 wrap off: goto leftmost onscreen g<Up> same as gk
={motion} filter {motion} lines through 'equalprg'
a search character of current line ---------------------------------------------------------------
external program
<return> next line g? rot13 encoding operator G goto line (100G); defaults to EOF
-----------------------------------------------------------------
<spacebar> next character --------------------------------------------------------------- ^g show status line
@ execute command in register
!!{filter} filter [count] lines through the g?? rot13 encode current line h left
[( goto previous unmatched '('
external program {filter} g?g? rot13 encode current line H goto first line on screen
[[ previous section
!{cmd}{filter} send {motion} text through gD goto definition of word under cursor in ^h backspace in insert mode, left in
[] go backwards count sections or to
external program {filter} current file command mode
previous '}' in 1st column
!!scramble toggle encryption of C/C++ string (AEK) gE go backwards to end of previous WORD ---------------------------------------------------------------
[{ goto previous unmatched '{'
---------------------------------------------------------------- gH start Select line mode i insert before current location (until Esc)
-----------------------------------------------------------------
<’a shift left up to mark --------------------------------------------------------------- insert before first non-whitespace
[# goto previous unmatched "#if" or "#else" I
<% shift left until matching (, [, or { gI like "I", but always start in column 1 character on line
[* goto previous start of a C comment (/*)
<< shift line one shiftwidth to the left gJ join lines without inserting space (like :j!) goto [count] cursor position in jump list
[i display 1st line that contains keyword ^I
>’a shift right up to mark ["x]gP put text (from register x) N times ---------------------------------------------------------------
under cursor
>% shift right until matching (, [, or { gR enter virtual replace mode j down
[I display all lines that contain keyword
>> shift line one shiftwidth to the right gU{motion} make Nmove text uppercase J join next line with current line
under cursor
---------------------------------------------------------------- --------------------------------------------------------------- down in command, create newline in insert
[^I jump to 1st line that contains keyword ^j
a append after the current location gV don't reselect previous Visual area ---------------------------------------------------------------
under cursor
k up --------------------------------------------------------------- --------------------------------------------------------------- ---------------------------------------------------------------
K use keywordprg (kp option) to lookup w beginning of next word x delete current character :set [all] show modified options (or all)
keyword under cursor W beginning of next word, ignore X delete previous character :set [no]autoindent automatically indent each line
^k xx enter digraph specified by two characters punctuation ^x^n append next word to completion (see ^n) :set [no]expandtab convert inserted ^I to spaces
--------------------------------------------------------------- --------------------------------------------------------------- ^x^p ditto. Typical: longFunc^p^x^p^x^p^x^p :set fileencodings=ucs-2le
l right ^W ^] same as "^W ]" --------------------------------------------------------------- show next file as Windows Unicode (use :e!)
L goto last line on screen ^W ^^ same as "^W ^" y yank (:1,’ay); see P :set [no]ignorecase ignore case in searches
^l redraw screen ^W ^_ same as "^W _" Y yank N lines (10Y); see P :set [no]list show tabs as ^I and EOL with $
--------------------------------------------------------------- ^W + increase current window height N lines ^y scroll screen up one line :set shiftwidth=n set shiftwidth for >>
m mark position into register (ma) ^W - decrease current window height N --------------------------------------------------------------- :set tabstop=n set tabstop for ^I
M goto middle of screen lines z redraw with line [count] at top-of-window :set textwidth=n set textwidth for autowrap
^m carriage return ^W = make all windows the same zc close fold ---------------------------------------------------------------
--------------------------------------------------------------- height zd delete fold Clipboard:
n repeat last search ^W ] split window and jump to tag under zo open fold ^C copy highlighted text to clipboard
N repeat last search, reverse direction cursor zL scroll screen half a screenwidth to left ^X cut highlighted text to clipboard (deletes)
^n down in command mode, ^W ^ split current window and edit zH scroll screen half a screenwidth to right ^Q paste text from clipboard (AEK mod)
^n show the next completion in insert mode alternate file N zs scroll text&cursor horizontally so cursor (not ^V – toggles Visual Block Mode)
--------------------------------------------------------------- ^W _ set current window height to N on right of screen ---------------------------------------------------------------
o open line below current (default: very high) ze scroll text&cursor horizontally so cursor Notes:
O open line above current --------------------------------------------------------------- on left of screen 1. ^ before a letter implies the Ctrl key
^W ^B go to bottom window ZZ write (only if changes have been made) 2. All commands apply to Normal Mode unless
^o goto older cursor position in jump list
^W ^C close current window (like |:close|) and quit otherwise indicated. Many can be invoked in
---------------------------------------------------------------
^W ^D split window and jump to definition --------------------------------------------------------------- Insert Mode as well by typing ^O followed by
p put below current line
under the cursor z{height}<CR> redraw window {height} the desired keystroke(s). Example: ^OFZ
P put above current line; see y.
^W ^F split window and edit file name under lines tall searches backward for Z.
After Ndd, puts deleted text.
the cursor z<Right> wrap off: scroll screen [count] 3. See “:help motion”for a description of motion
^p up in command mode
^W g ^] split window and do |:tjump| to tag characters to left keystrokes for {motion}
^p show the prev completion in insert mode under cursor
--------------------------------------------------------------- z<Left> scroll screen [count] characters
^W g ] split window and do |:tselect| for tag to right
qx record typed characters into register x under cursor
q stop macro recording ---------------------------------------------------------------
^W g } do a |:ptjump| to the tag under the :s/old/new/ substitute text on current line
Q quit and run ex cursor s/line1/line1^V^Mline2/ for newline
^q same as ctrl-v ^W ^I split window & jump to declaration of :s/old/new/<flags> apply special flags:
--------------------------------------------------------------- identifier under cursor c confirm each subst with y/n
r replace current character ^W ^J go to N next window (stop at last g subst all occurrences on same line
R replace characters until Esc window) :1,Ns/old/new/ subst on lines 1-N
^r redraw screen in command mode ^W ^K go to N previous window (stop at first :.,’as/old/new/ subst from current line to mark a
--------------------------------------------------------------- window) :%s/old/new/ subst on all lines
s substitute char under cursor ^W ^N open new window, N lines high :g/text/d delete all lines containing text
S substitute entire line ^W ^O close all but current window (|:only|) :v/text/d delete all lines not containing text
^s split current window into two (AEK) ^W ^P go to previous window ---------------------------------------------------------------
--------------------------------------------------------------- ^W ^Q quit current window (like |:quit|) :cd <path> change dir (cd – to pop back)
t to... ^W ^R rotate windows downwards N times :e <file> edit file. e! to force
T backward to... ^W ^S split current window in two parts, :e ++enc=ucs-2le <file> Load as Unicode
^t jump back to referer from tag def (see ^[ ) :e ++ff=unix <file> Load EOLs as \n; also =dos
new window N lines high (|:split|)
^t move to next shiftwidth in insert mode ^W ^T go to top window :.,.+10fold fold 10 lines at cursor. See zc, zd, zo
--------------------------------------------------------------- ^W ^W go to N next window (wrap around) :f <name> rename file
u undo last change (toggle) :hardcopy send file to printer
^W ^X exchange current window with window N
U undo changes to current line (default: next window) :X encrypt file contents
^u scroll up half a window (N^u sets default) ^W ^Z close preview window :w <file> write file. :w! to force
v start Visual mode at given character ^W } show tag under cursor in preview window :w ++enc=utf-8 <file> Write out as UTF-8
V start linewise Visual mode --------------------------------------------------------------- :w ++enc=ucs-2le <file> Write out as Unicode
^v start blockwise Visual mode (in insert mode ^W <Down> same as "^W j" :w ++ff=unix <file> Convert \r\n to \n; also =dos
begins insertion of a literal char) ^W <Up> same as "^W k" :q quit. q! to force

You might also like