*quickref.txt* For Vim version 7.1. Last change: 2007 May 11 VIM REFERENCE MANUAL by Bram Moolenaar Quick reference guide *quickref* *Contents* tag subject tag subject ~|Q_ct| list of help files |Q_re| Repeating commands|Q_lr| motion: Left-right |Q_km| Key mapping|Q_ud| motion: Up-down |Q_ab| Abbreviations|Q_tm| motion: Text object |Q_op| Options|Q_pa| motion: Pattern searches |Q_ur| Undo/Redo commands|Q_ma| motion: Marks |Q_et| External commands|Q_vm| motion: Various |Q_qf| Quickfix commands|Q_ta| motion: Using tags |Q_vc| Various commands|Q_sc| Scrolling |Q_ce| Ex: Command-line editing|Q_in| insert: Inserting text |Q_ra| Ex: Ranges|Q_ai| insert: Keys |Q_ex| Ex: Special characters|Q_ss| insert: Special keys |Q_st| Starting VIM|Q_di| insert: Digraphs |Q_ed| Editing a file|Q_si| insert: Special inserts |Q_fl| Using the argument list|Q_de| change: Deleting text |Q_wq| Writing and quitting|Q_cm| change: Copying and moving |Q_ac| Automatic commands|Q_ch| change: Changing text |Q_wi| Multi-window commands|Q_co| change: Complex |Q_bu| Buffer list commands|Q_vi| Visual mode |Q_sy| Syntax highlighting|Q_to| Text objects |Q_gu| GUI commands |Q_fo| Folding ------------------------------------------------------------------------------N is used to indicate an optional count that can be given before the command.------------------------------------------------------------------------------*Q_lr* Left-right motions |h| N h left (also: CTRL-H, <BS>, or <Left> key)|l| N l right (also: <Space> or <Right> key)|0| 0 to first character in the line (also: <Home> key)|^| ^ to first non-blank character in the line|$| N $ to the last character in the line (N-1 lines lower) (also: <End> key)|g0| N g0 to first character in screen line (differs from "0" when lines wrap)|g^| N g^ to first non-blank character in screen line (differs from "^" when lines wrap)|g$| N g$ to last character in screen line (differs from "$" when lines wrap)|gm| N gm to middle of the screen line|bar| N | to column N (default: 1)|f| N f{char} to the Nth occurrence of {char} to the right|F| N F{char} to the Nth occurrence of {char} to the left|t| N t{char} till before the Nth occurrence of {char} to the right|T| N T{char} till before the Nth occurrence of {char} to the left|;| N ; repeat the last "f", "F", "t", or "T" N times|,| N , repeat the last "f", "F", "t", or "T" N times in opposite direction------------------------------------------------------------------------------*Q_ud* Up-down motions |k| N k up N lines (also: CTRL-P and <Up>)|j| N j down N lines (also: CTRL-J, CTRL-N, <NL>, and <Down>)|-| N - up N lines, on the first non-blank character|+| N + down N lines, on the first non-blank character (also: CTRL-M and <CR>)|_| N _ down N-1 lines, on the first non-blank character|G| N G goto line N (default: last line), on the first non-blank character|gg| N gg goto line N (default: first line), on the first non-blank character|N%| N % goto line N percentage down in the file. N must be given, otherwise it is the |%| command.|gk| N gk up N screen lines (differs from "k" when line wraps)|gj| N gj down N screen lines (differs from "j" when line wraps)------------------------------------------------------------------------------*Q_tm* Text object motions |w| N w N words forward|W| N W N blank-separated |WORD|s forward|e| N e forward to the end of the Nth word|E| N E forward to the end of the Nth blank-separated |WORD||b| N b N words backward|B| N B N blank-separated |WORD|s backward|ge| N ge backward to the end of the Nth word|gE| N gE backward to the end of the Nth blank-separated |WORD| |)| N ) N sentences forward|(| N ( N sentences backward|}| N } N paragraphs forward|{| N { N paragraphs backward|]]| N ]] N sections forward, at start of section|[[| N [[ N sections backward, at start of section|][| N ][ N sections forward, at end of section|[]| N [] N sections backward, at end of section|[(| N [( N times back to unclosed '('|[{| N [{ N times back to unclosed '{'|[m| N [m N times back to start of method (for Java)|[M| N [M N times back to end of method (for Java)|])| N ]) N times forward to unclosed ')'|]}| N ]} N times forward to unclosed '}'|]m| N ]m N times forward to start of method (for Java)|]M| N ]M N times forward to end of method (for Java)|[#| N [# N times back to unclosed "#if" or "#else"|]#| N ]# N times forward to unclosed "#else" or "#endif"|[star| N [* N times back to start of comment "/*"|]star| N ]* N times forward to end of comment "*/"------------------------------------------------------------------------------*Q_pa* Pattern searches |/| N /{pattern}[/[offset]]<CR> search forward for the Nth occurrence of {pattern}|?| N ?{pattern}[?[offset]]<CR> search backward for the Nth occurrence of {pattern}|/<CR>| N /<CR> repeat last search, in the forward direction|?<CR>| N ?<CR> repeat last search, in the backward direction|n| N n repeat last search|N| N N repeat last search, in opposite direction|star| N * search forward for the identifier under the cursor|#| N # search backward for the identifier under the cursor|gstar| N g* like "*", but also find partial matches|g#| N g# like "#", but also find partial matches|gd| gd goto local declaration of identifier under the cursor|gD| gD goto global declaration of identifier under the cursor |pattern| Special characters in search patterns meaning magic nomagic ~ matches any single character . \. matches start of line ^ ^ matches <EOL> $ $ matches start of word \< \< matches end of word \> \> matches a single char from the range [a-z] \[a-z] matches a single char not in the range [^a-z] \[^a-z] matches an identifier char \i \i idem but excluding digits \I \I matches a keyword character \k \k idem but excluding digits \K \K matches a file name character \f \f idem but excluding digits \F \F matches a printable character \p \p idem but excluding digits \P \P matches a white space character \s \s matches a non-white space character \S \S matches <Esc> \e \e matches <Tab> \t \t matches <CR> \r \r matches <BS> \b \b matches 0 or more of the preceding atom * \* matches 1 or more of the preceding atom \+ \+ matches 0 or 1 of the preceding atom \= \= matches 2 to 5 of the preceding atom \{2,5} \{2,5} separates two alternatives \| \| group a pattern into an atom \(\) \(\) |search-offset| Offsets allowed after search command [num] [num] lines downwards, in column 1 +[num] [num] lines downwards, in column 1 -[num] [num] lines upwards, in column 1 e[+num] [num] characters to the right of the end of the match e[-num] [num] characters to the left of the end of the match s[+num] [num] characters to the right of the start of the match s[-num] [num] characters to the left of the start of the match b[+num] [num] identical to s[+num] above (mnemonic: begin) b[-num] [num] identical to s[-num] above (mnemonic: begin) ;{search-command} execute {search-command} next------------------------------------------------------------------------------*Q_ma* Marks and motions |m| m{a-zA-Z} mark current position with mark {a-zA-Z}|`a| `{a-z} go to mark {a-z} within current file|`A| `{A-Z} go to mark {A-Z} in any file|`0| `{0-9} go to the position where Vim was previously exited|``| `` go to the position before the last jump|`quote| `" go to the position when last editing this file|`[| `[ go to the start of the previously operated or put text|`]| `] go to the end of the previously operated or put text|`<| `< go to the start of the (previous) Visual area|`>| `> go to the end of the (previous) Visual area|`.| `. go to the position of the last change in this file|'| '{a-zA-Z0-9[]'"<>.} same as `, but on the first non-blank in the line|:marks| :marks print the active marks|CTRL-O| N CTRL-O go to Nth older position in jump list|CTRL-I| N CTRL-I go to Nth newer position in jump list|:ju| :ju[mps] print the jump list------------------------------------------------------------------------------*Q_vm* Various motions |%| % find the next brace, bracket, comment, or "#if"/ "#else"/"#endif" in this line and go to its match|H| N H go to the Nth line in the window, on the first non-blank|M| M go to the middle line in the window, on the first non-blank|L| N L go to the Nth line from the bottom, on the first non-blank |go| N go go to Nth byte in the buffer|:go| :[range]go[to] [off] go to [off] byte in the buffer------------------------------------------------------------------------------*Q_ta* Using tags |:ta| :ta[g][!] {tag} Jump to tag {tag}|:ta| :[count]ta[g][!] Jump to [count]'th newer tag in tag list|CTRL-]| CTRL-] Jump to the tag under cursor, unless changes have been made|:ts| :ts[elect][!] [tag] List matching tags and select one to jump to|:tjump| :tj[ump][!] [tag] Jump to tag [tag] or select from list when there are multiple matches|:ltag| :lt[ag][!] [tag] Jump to tag [tag] and add matching tags to the location list. |:tags| :tags Print tag list|CTRL-T| N CTRL-T Jump back from Nth older tag in tag list|:po| :[count]po[p][!] Jump back from [count]'th older tag in tag list|:tnext| :[count]tn[ext][!] Jump to [count]'th next matching tag|:tp| :[count]tp[revious][!] Jump to [count]'th previous matching tag|:tr| :[count]tr[ewind][!] Jump to [count]'th matching tag|:tl| :tl[ast][!] Jump to last matching tag |:ptag| :pt[ag] {tag} open a preview window to show tag {tag}|CTRL-W_}| CTRL-W } like CTRL-] but show tag in preview window|:pts| :pts[elect] like ":tselect" but show tag in preview window|:ptjump| :ptj[ump] like ":tjump" but show tag in preview window|:pclose| :pc[lose] close tag preview window|CTRL-W_z| CTRL-W z close tag preview window------------------------------------------------------------------------------*Q_sc* Scrolling |CTRL-E| N CTRL-E window N lines downwards (default: 1)|CTRL-D| N CTRL-D window N lines Downwards (default: 1/2 window)|CTRL-F| N CTRL-F window N pages Forwards (downwards)|CTRL-Y| N CTRL-Y window N lines upwards (default: 1)|CTRL-U| N CTRL-U window N lines Upwards (default: 1/2 window)|CTRL-B| N CTRL-B window N pages Backwards (upwards)|z<CR>| z<CR> or zt redraw, current line at top of window|z.| z. or zz redraw, current line at center of window|z-| z- or zb redraw, current line at bottom of window These only work when 'wrap' is off:|zh| N zh scroll screen N characters to the right|zl| N zl scroll screen N characters to the left|zH| N zH scroll screen half a screenwidth to the right|zL| N zL scroll screen half a screenwidth to the left------------------------------------------------------------------------------*Q_in* Inserting text |a| N a append text after the cursor (N times)|A| N A append text at the end of the line (N times)|i| N i insert text before the cursor (N times) (also: <Insert>)|I| N I insert text before the first non-blank in the line (N times)|gI| N gI insert text in column 1 (N times)|o| N o open a new line below the current line, append text (N times)|O| N O open a new line above the current line, append text (N times)|:startinsert| :star[tinsert][!] start Insert mode, append when [!] used|:startreplace| :startr[eplace][!] start Replace mode, at EOL when [!] used in Visual block mode:|v_b_I| I insert the same text in front of all the selected lines|v_b_A| A append the same text after all the selected lines------------------------------------------------------------------------------*Q_ai* Insert mode keys |insert-index| alphabetical index of Insert mode commands leaving Insert mode:|i_<Esc>| <Esc> end Insert mode, back to Normal mode|i_CTRL-C| CTRL-C like <Esc>, but do not use an abbreviation|i_CTRL-O| CTRL-O {command} execute {command} and return to Insert mode moving around:|i_<Up>| cursor keys move cursor left/right/up/down|i_<S-Left>| shift-left/right one word left/right|i_<S-Up>| shift-up/down one screenful backward/forward|i_<End>| <End> cursor after last character in the line|i_<Home>| <Home> cursor to first character in the line------------------------------------------------------------------------------*Q_ss* Special keys in Insert mode |i_CTRL-V| CTRL-V {char}.. insert character literally, or enter decimal byte value|i_<NL>| <NL> or <CR> or CTRL-M or CTRL-J begin new line|i_CTRL-E| CTRL-E insert the character from below the cursor|i_CTRL-Y| CTRL-Y insert the character from above the cursor |i_CTRL-A| CTRL-A insert previously inserted text|i_CTRL-@| CTRL-@ insert previously inserted text and stop Insert mode|i_CTRL-R| CTRL-R {0-9a-z%#:.-="} insert the contents of a register |i_CTRL-N| CTRL-N insert next match of identifier before the cursor|i_CTRL-P| CTRL-P insert previous match of identifier before the cursor|i_CTRL-X| CTRL-X ... complete the word before the cursor in various ways |i_<BS>| <BS> or CTRL-H delete the character before the cursor|i_<Del>| <Del> delete the character under the cursor|i_CTRL-W| CTRL-W delete word before the cursor|i_CTRL-U| CTRL-U delete all entered characters in the current line|i_CTRL-T| CTRL-T insert one shiftwidth of indent in front of the current line|i_CTRL-D| CTRL-D delete one shiftwidth of indent in front of the current line|i_0_CTRL-D| 0 CTRL-D delete all indent in the current line|i_^_CTRL-D| ^ CTRL-D delete all indent in the current line, restore indent in next line------------------------------------------------------------------------------*Q_di* Digraphs |:dig| :dig[raphs] show current list of digraphs|:dig| :dig[raphs] {char1}{char2} {number} ... add digraph(s) to the list In Insert or Command-line mode:|i_CTRL-K| CTRL-K {char1} {char2} enter digraph|i_digraph| {char1} <BS> {char2} enter digraph if 'digraph' option set------------------------------------------------------------------------------*Q_si* Special inserts |:r| :r [file] insert the contents of [file] below the cursor|:r!| :r! {command} insert the standard output of {command} below the cursor------------------------------------------------------------------------------*Q_de* Deleting text |x| N x delete N characters under and after the cursor|<Del>| N <Del> delete N characters under and after the cursor|X| N X delete N characters before the cursor|d| N d{motion} delete the text that is moved over with {motion}|v_d| {visual}d delete the highlighted text|dd| N dd delete N lines|D| N D delete to the end of the line (and N-1 more lines)|J| N J join N-1 lines (delete <EOL>s)|v_J| {visual}J join the highlighted lines|gJ| N gJ like "J", but without inserting spaces|v_gJ| {visual}gJ like "{visual}J", but without inserting spaces|:d| :[range]d [x] delete [range] lines [into register x]------------------------------------------------------------------------------*Q_cm* Copying and moving text |quote| "{char} use register {char} for the next delete, yank, or put|:reg| :reg show the contents of all registers|:reg| :reg {arg} show the contents of registers mentioned in {arg}|y| N y{motion} yank the text moved over with {motion} into a register|v_y| {visual}y yank the highlighted text into a register|yy| N yy yank N lines into a register|Y| N Y yank N lines into a register|p| N p put a register after the cursor position (N times)|P| N P put a register before the cursor position (N times)|]p| N ]p like p, but adjust indent to current line|[p| N [p like P, but adjust indent to current line|gp| N gp like p, but leave cursor after the new text|gP| N gP like P, but leave cursor after the new text------------------------------------------------------------------------------*Q_ch* Changing text |r| N r{char} replace N characters with {char}|gr| N gr{char} replace N characters without affecting layout|R| N R enter Replace mode (repeat the entered text N times)|gR| N gR enter virtual Replace mode: Like Replace mode but without affecting layout|v_b_r| {visual}r{char} in Visual block mode: Replace each char of the selected text with {char} (change = delete text and enter Insert mode)|c| N c{motion} change the text that is moved over with {motion}|v_c| {visual}c change the highlighted text|cc| N cc change N lines|S| N S change N lines|C| N C change to the end of the line (and N-1 more lines)|s| N s change N characters|v_b_c| {visual}c in Visual block mode: Change each of the selected lines with the entered text|v_b_C| {visual}C in Visual block mode: Change each of the selected lines until end-of-line with the entered text |~| N ~ switch case for N characters and advance cursor|v_~| {visual}~ switch case for highlighted text|v_u| {visual}u make highlighted text lowercase|v_U| {visual}U make highlighted text uppercase|g~| g~{motion} switch case for the text that is moved over with {motion}|gu| gu{motion} make the text that is moved over with {motion} lowercase|gU| gU{motion} make the text that is moved over with {motion} uppercase|v_g?| {visual}g? perform rot13 encoding on highlighted text|g?| g?{motion} perform rot13 encoding on the text that is moved over with {motion} |CTRL-A| N CTRL-A add N to the number at or after the cursor|CTRL-X| N CTRL-X subtract N from the number at or after the cursor |<| N <{motion} move the lines that are moved over with {motion} one shiftwidth left|<<| N << move N lines one shiftwidth left|>| N >{motion} move the lines that are moved over with {motion} one shiftwidth right|>>| N >> move N lines one shiftwidth right|gq| N gq{motion} format the lines that are moved over with {motion} to 'textwidth' length|:ce| :[range]ce[nter] [width] center the lines in [range]|:le| :[range]le[ft] [indent] left-align the lines in [range] (with [indent])|:ri| :[range]ri[ght] [width] right-align the lines in [range]------------------------------------------------------------------------------*Q_co* Complex changes |!| N !{motion}{command}<CR> filter the lines that are moved over through {command}|!!| N !!{command}<CR> filter N lines through {command}|v_!| {visual}!{command}<CR> filter the highlighted lines through {command}|:range!| :[range]! {command}<CR> filter [range] lines through {command}|=| N ={motion} filter the lines that are moved over through 'equalprg'|==| N == filter N lines through 'equalprg'|v_=| {visual}= filter the highlighted lines through 'equalprg'|:s| :[range]s[ubstitute]/{pattern}/{string}/[g][c] substitute {pattern} by {string} in [range] lines; with [g], replace all occurrences of {pattern}; with [c], confirm each replacement|:s| :[range]s[ubstitute] [g][c] repeat previous ":s" with new range and options|&| & Repeat previous ":s" on current line without options|:ret| :[range]ret[ab][!] [tabstop] set 'tabstop' to new value and adjust white space accordingly------------------------------------------------------------------------------*Q_vi* Visual mode |visual-index| list of Visual mode commands. |v| v start highlighting characters } move cursor and use|V| V start highlighting linewise } operator to affect|CTRL-V| CTRL-V start highlighting blockwise } highlighted text|v_o| o exchange cursor position with start of highlighting|gv| gv start highlighting on previous visual area|v_v| v highlight characters or stop highlighting|v_V| V highlight linewise or stop highlighting|v_CTRL-V| CTRL-V highlight blockwise or stop highlighting------------------------------------------------------------------------------*Q_to* Text objects (only in Visual mode or after an operator) |v_aw| N aw Select "a word"|v_iw| N iw Select "inner word"|v_aW| N aW Select "a |WORD|"|v_iW| N iW Select "inner |WORD|"|v_as| N as Select "a sentence"|v_is| N is Select "inner sentence"|v_ap| N ap Select "a paragraph"|v_ip| N ip Select "inner paragraph"|v_ab| N ab Select "a block" (from "[(" to "])")|v_ib| N ib Select "inner block" (from "[(" to "])")|v_aB| N aB Select "a Block" (from "[{" to "]}")|v_iB| N iB Select "inner Block" (from "[{" to "]}")------------------------------------------------------------------------------*Q_re* Repeating commands |.| N . repeat last change (with count replaced with N)|q| q{a-z} record typed characters into register {a-z}|q| q{A-Z} record typed characters, appended to register {a-z}|q| q stop recording|@| N @{a-z} execute the contents of register {a-z} (N times)|@@| N @@ repeat previous @{a-z} (N times)|:@| :@{a-z} execute the contents of register {a-z} as an Ex command|:@@| :@@ repeat previous :@{a-z}|:g| :[range]g[lobal]/{pattern}/[cmd] Execute Ex command [cmd] (default: ":p") on the lines within [range] where {pattern} matches.|:g| :[range]g[lobal]!/{pattern}/[cmd] Execute Ex command [cmd] (default: ":p") on the lines within [range] where {pattern} does NOT match.|:so| :so[urce] {file} Read Ex commands from {file}.|:so| :so[urce]! {file} Read Vim commands from {file}.|:sl| :sl[eep] [sec] don't do anything for [sec] seconds|gs| N gs Goto Sleep for N seconds------------------------------------------------------------------------------*Q_km* Key mapping Lines 1–500 of 1376. Load more
*quickref.txt* For Vim version 7.1. Last change: 2007 May 11 VIM REFERENCE MANUAL by Bram Moolenaar Quick reference guide *quickref* *Contents* tag subject tag subject ~ |Q_ct| list of help files |Q_re| Repeating commands |Q_lr| motion: Left-right |Q_km| Key mapping |Q_ud| motion: Up-down |Q_ab| Abbreviations |Q_tm| motion: Text object |Q_op| Options |Q_pa| motion: Pattern searches |Q_ur| Undo/Redo commands |Q_ma| motion: Marks |Q_et| External commands |Q_vm| motion: Various |Q_qf| Quickfix commands |Q_ta| motion: Using tags |Q_vc| Various commands |Q_sc| Scrolling |Q_ce| Ex: Command-line editing |Q_in| insert: Inserting text |Q_ra| Ex: Ranges |Q_ai| insert: Keys |Q_ex| Ex: Special characters |Q_ss| insert: Special keys |Q_st| Starting VIM |Q_di| insert: Digraphs |Q_ed| Editing a file |Q_si| insert: Special inserts |Q_fl| Using the argument list |Q_de| change: Deleting text |Q_wq| Writing and quitting |Q_cm| change: Copying and moving |Q_ac| Automatic commands |Q_ch| change: Changing text |Q_wi| Multi-window commands |Q_co| change: Complex |Q_bu| Buffer list commands |Q_vi| Visual mode |Q_sy| Syntax highlighting |Q_to| Text objects |Q_gu| GUI commands |Q_fo| Folding ------------------------------------------------------------------------------ N is used to indicate an optional count that can be given before the command. ------------------------------------------------------------------------------ *Q_lr* Left-right motions |h| N h left (also: CTRL-H, <BS>, or <Left> key) |l| N l right (also: <Space> or <Right> key) |0| 0 to first character in the line (also: <Home> key) |^| ^ to first non-blank character in the line |$| N $ to the last character in the line (N-1 lines lower) (also: <End> key) |g0| N g0 to first character in screen line (differs from "0" when lines wrap) |g^| N g^ to first non-blank character in screen line (differs from "^" when lines wrap) |g$| N g$ to last character in screen line (differs from "$" when lines wrap) |gm| N gm to middle of the screen line |bar| N | to column N (default: 1) |f| N f{char} to the Nth occurrence of {char} to the right |F| N F{char} to the Nth occurrence of {char} to the left |t| N t{char} till before the Nth occurrence of {char} to the right |T| N T{char} till before the Nth occurrence of {char} to the left |;| N ; repeat the last "f", "F", "t", or "T" N times |,| N , repeat the last "f", "F", "t", or "T" N times in opposite direction ------------------------------------------------------------------------------ *Q_ud* Up-down motions |k| N k up N lines (also: CTRL-P and <Up>) |j| N j down N lines (also: CTRL-J, CTRL-N, <NL>, and <Down>) |-| N - up N lines, on the first non-blank character |+| N + down N lines, on the first non-blank character (also: CTRL-M and <CR>) |_| N _ down N-1 lines, on the first non-blank character |G| N G goto line N (default: last line), on the first non-blank character |gg| N gg goto line N (default: first line), on the first non-blank character |N%| N % goto line N percentage down in the file. N must be given, otherwise it is the |%| command. |gk| N gk up N screen lines (differs from "k" when line wraps) |gj| N gj down N screen lines (differs from "j" when line wraps) ------------------------------------------------------------------------------ *Q_tm* Text object motions |w| N w N words forward |W| N W N blank-separated |WORD|s forward |e| N e forward to the end of the Nth word |E| N E forward to the end of the Nth blank-separated |WORD| |b| N b N words backward |B| N B N blank-separated |WORD|s backward |ge| N ge backward to the end of the Nth word |gE| N gE backward to the end of the Nth blank-separated |WORD| |)| N ) N sentences forward |(| N ( N sentences backward |}| N } N paragraphs forward |{| N { N paragraphs backward |]]| N ]] N sections forward, at start of section |[[| N [[ N sections backward, at start of section |][| N ][ N sections forward, at end of section |[]| N [] N sections backward, at end of section |[(| N [( N times back to unclosed '(' |[{| N [{ N times back to unclosed '{' |[m| N [m N times back to start of method (for Java) |[M| N [M N times back to end of method (for Java) |])| N ]) N times forward to unclosed ')' |]}| N ]} N times forward to unclosed '}' |]m| N ]m N times forward to start of method (for Java) |]M| N ]M N times forward to end of method (for Java) |[#| N [# N times back to unclosed "#if" or "#else" |]#| N ]# N times forward to unclosed "#else" or "#endif" |[star| N [* N times back to start of comment "/*" |]star| N ]* N times forward to end of comment "*/" ------------------------------------------------------------------------------ *Q_pa* Pattern searches |/| N /{pattern}[/[offset]]<CR> search forward for the Nth occurrence of {pattern} |?| N ?{pattern}[?[offset]]<CR> search backward for the Nth occurrence of {pattern} |/<CR>| N /<CR> repeat last search, in the forward direction |?<CR>| N ?<CR> repeat last search, in the backward direction |n| N n repeat last search |N| N N repeat last search, in opposite direction |star| N * search forward for the identifier under the cursor |#| N # search backward for the identifier under the cursor |gstar| N g* like "*", but also find partial matches |g#| N g# like "#", but also find partial matches |gd| gd goto local declaration of identifier under the cursor |gD| gD goto global declaration of identifier under the cursor |pattern| Special characters in search patterns meaning magic nomagic ~ matches any single character . \. matches start of line ^ ^ matches <EOL> $ $ matches start of word \< \< matches end of word \> \> matches a single char from the range [a-z] \[a-z] matches a single char not in the range [^a-z] \[^a-z] matches an identifier char \i \i idem but excluding digits \I \I matches a keyword character \k \k idem but excluding digits \K \K matches a file name character \f \f idem but excluding digits \F \F matches a printable character \p \p idem but excluding digits \P \P matches a white space character \s \s matches a non-white space character \S \S matches <Esc> \e \e matches <Tab> \t \t matches <CR> \r \r matches <BS> \b \b matches 0 or more of the preceding atom * \* matches 1 or more of the preceding atom \+ \+ matches 0 or 1 of the preceding atom \= \= matches 2 to 5 of the preceding atom \{2,5} \{2,5} separates two alternatives \| \| group a pattern into an atom \(\) \(\) |search-offset| Offsets allowed after search command [num] [num] lines downwards, in column 1 +[num] [num] lines downwards, in column 1 -[num] [num] lines upwards, in column 1 e[+num] [num] characters to the right of the end of the match e[-num] [num] characters to the left of the end of the match s[+num] [num] characters to the right of the start of the match s[-num] [num] characters to the left of the start of the match b[+num] [num] identical to s[+num] above (mnemonic: begin) b[-num] [num] identical to s[-num] above (mnemonic: begin) ;{search-command} execute {search-command} next ------------------------------------------------------------------------------ *Q_ma* Marks and motions |m| m{a-zA-Z} mark current position with mark {a-zA-Z} |`a| `{a-z} go to mark {a-z} within current file |`A| `{A-Z} go to mark {A-Z} in any file |`0| `{0-9} go to the position where Vim was previously exited |``| `` go to the position before the last jump |`quote| `" go to the position when last editing this file |`[| `[ go to the start of the previously operated or put text |`]| `] go to the end of the previously operated or put text |`<| `< go to the start of the (previous) Visual area |`>| `> go to the end of the (previous) Visual area |`.| `. go to the position of the last change in this file |'| '{a-zA-Z0-9[]'"<>.} same as `, but on the first non-blank in the line |:marks| :marks print the active marks |CTRL-O| N CTRL-O go to Nth older position in jump list |CTRL-I| N CTRL-I go to Nth newer position in jump list |:ju| :ju[mps] print the jump list ------------------------------------------------------------------------------ *Q_vm* Various motions |%| % find the next brace, bracket, comment, or "#if"/ "#else"/"#endif" in this line and go to its match |H| N H go to the Nth line in the window, on the first non-blank |M| M go to the middle line in the window, on the first non-blank |L| N L go to the Nth line from the bottom, on the first non-blank |go| N go go to Nth byte in the buffer |:go| :[range]go[to] [off] go to [off] byte in the buffer ------------------------------------------------------------------------------ *Q_ta* Using tags |:ta| :ta[g][!] {tag} Jump to tag {tag} |:ta| :[count]ta[g][!] Jump to [count]'th newer tag in tag list |CTRL-]| CTRL-] Jump to the tag under cursor, unless changes have been made |:ts| :ts[elect][!] [tag] List matching tags and select one to jump to |:tjump| :tj[ump][!] [tag] Jump to tag [tag] or select from list when there are multiple matches |:ltag| :lt[ag][!] [tag] Jump to tag [tag] and add matching tags to the location list. |:tags| :tags Print tag list |CTRL-T| N CTRL-T Jump back from Nth older tag in tag list |:po| :[count]po[p][!] Jump back from [count]'th older tag in tag list |:tnext| :[count]tn[ext][!] Jump to [count]'th next matching tag |:tp| :[count]tp[revious][!] Jump to [count]'th previous matching tag |:tr| :[count]tr[ewind][!] Jump to [count]'th matching tag |:tl| :tl[ast][!] Jump to last matching tag |:ptag| :pt[ag] {tag} open a preview window to show tag {tag} |CTRL-W_}| CTRL-W } like CTRL-] but show tag in preview window |:pts| :pts[elect] like ":tselect" but show tag in preview window |:ptjump| :ptj[ump] like ":tjump" but show tag in preview window |:pclose| :pc[lose] close tag preview window |CTRL-W_z| CTRL-W z close tag preview window ------------------------------------------------------------------------------ *Q_sc* Scrolling |CTRL-E| N CTRL-E window N lines downwards (default: 1) |CTRL-D| N CTRL-D window N lines Downwards (default: 1/2 window) |CTRL-F| N CTRL-F window N pages Forwards (downwards) |CTRL-Y| N CTRL-Y window N lines upwards (default: 1) |CTRL-U| N CTRL-U window N lines Upwards (default: 1/2 window) |CTRL-B| N CTRL-B window N pages Backwards (upwards) |z<CR>| z<CR> or zt redraw, current line at top of window |z.| z. or zz redraw, current line at center of window |z-| z- or zb redraw, current line at bottom of window These only work when 'wrap' is off: |zh| N zh scroll screen N characters to the right |zl| N zl scroll screen N characters to the left |zH| N zH scroll screen half a screenwidth to the right |zL| N zL scroll screen half a screenwidth to the left ------------------------------------------------------------------------------ *Q_in* Inserting text |a| N a append text after the cursor (N times) |A| N A append text at the end of the line (N times) |i| N i insert text before the cursor (N times) (also: <Insert>) |I| N I insert text before the first non-blank in the line (N times) |gI| N gI insert text in column 1 (N times) |o| N o open a new line below the current line, append text (N times) |O| N O open a new line above the current line, append text (N times) |:startinsert| :star[tinsert][!] start Insert mode, append when [!] used |:startreplace| :startr[eplace][!] start Replace mode, at EOL when [!] used in Visual block mode: |v_b_I| I insert the same text in front of all the selected lines |v_b_A| A append the same text after all the selected lines ------------------------------------------------------------------------------ *Q_ai* Insert mode keys |insert-index| alphabetical index of Insert mode commands leaving Insert mode: |i_<Esc>| <Esc> end Insert mode, back to Normal mode |i_CTRL-C| CTRL-C like <Esc>, but do not use an abbreviation |i_CTRL-O| CTRL-O {command} execute {command} and return to Insert mode moving around: |i_<Up>| cursor keys move cursor left/right/up/down |i_<S-Left>| shift-left/right one word left/right |i_<S-Up>| shift-up/down one screenful backward/forward |i_<End>| <End> cursor after last character in the line |i_<Home>| <Home> cursor to first character in the line ------------------------------------------------------------------------------ *Q_ss* Special keys in Insert mode |i_CTRL-V| CTRL-V {char}.. insert character literally, or enter decimal byte value |i_<NL>| <NL> or <CR> or CTRL-M or CTRL-J begin new line |i_CTRL-E| CTRL-E insert the character from below the cursor |i_CTRL-Y| CTRL-Y insert the character from above the cursor |i_CTRL-A| CTRL-A insert previously inserted text |i_CTRL-@| CTRL-@ insert previously inserted text and stop Insert mode |i_CTRL-R| CTRL-R {0-9a-z%#:.-="} insert the contents of a register |i_CTRL-N| CTRL-N insert next match of identifier before the cursor |i_CTRL-P| CTRL-P insert previous match of identifier before the cursor |i_CTRL-X| CTRL-X ... complete the word before the cursor in various ways |i_<BS>| <BS> or CTRL-H delete the character before the cursor |i_<Del>| <Del> delete the character under the cursor |i_CTRL-W| CTRL-W delete word before the cursor |i_CTRL-U| CTRL-U delete all entered characters in the current line |i_CTRL-T| CTRL-T insert one shiftwidth of indent in front of the current line |i_CTRL-D| CTRL-D delete one shiftwidth of indent in front of the current line |i_0_CTRL-D| 0 CTRL-D delete all indent in the current line |i_^_CTRL-D| ^ CTRL-D delete all indent in the current line, restore indent in next line ------------------------------------------------------------------------------ *Q_di* Digraphs |:dig| :dig[raphs] show current list of digraphs |:dig| :dig[raphs] {char1}{char2} {number} ... add digraph(s) to the list In Insert or Command-line mode: |i_CTRL-K| CTRL-K {char1} {char2} enter digraph |i_digraph| {char1} <BS> {char2} enter digraph if 'digraph' option set ------------------------------------------------------------------------------ *Q_si* Special inserts |:r| :r [file] insert the contents of [file] below the cursor |:r!| :r! {command} insert the standard output of {command} below the cursor ------------------------------------------------------------------------------ *Q_de* Deleting text |x| N x delete N characters under and after the cursor |<Del>| N <Del> delete N characters under and after the cursor |X| N X delete N characters before the cursor |d| N d{motion} delete the text that is moved over with {motion} |v_d| {visual}d delete the highlighted text |dd| N dd delete N lines |D| N D delete to the end of the line (and N-1 more lines) |J| N J join N-1 lines (delete <EOL>s) |v_J| {visual}J join the highlighted lines |gJ| N gJ like "J", but without inserting spaces |v_gJ| {visual}gJ like "{visual}J", but without inserting spaces |:d| :[range]d [x] delete [range] lines [into register x] ------------------------------------------------------------------------------ *Q_cm* Copying and moving text |quote| "{char} use register {char} for the next delete, yank, or put |:reg| :reg show the contents of all registers |:reg| :reg {arg} show the contents of registers mentioned in {arg} |y| N y{motion} yank the text moved over with {motion} into a register |v_y| {visual}y yank the highlighted text into a register |yy| N yy yank N lines into a register |Y| N Y yank N lines into a register |p| N p put a register after the cursor position (N times) |P| N P put a register before the cursor position (N times) |]p| N ]p like p, but adjust indent to current line |[p| N [p like P, but adjust indent to current line |gp| N gp like p, but leave cursor after the new text |gP| N gP like P, but leave cursor after the new text ------------------------------------------------------------------------------ *Q_ch* Changing text |r| N r{char} replace N characters with {char} |gr| N gr{char} replace N characters without affecting layout |R| N R enter Replace mode (repeat the entered text N times) |gR| N gR enter virtual Replace mode: Like Replace mode but without affecting layout |v_b_r| {visual}r{char} in Visual block mode: Replace each char of the selected text with {char} (change = delete text and enter Insert mode) |c| N c{motion} change the text that is moved over with {motion} |v_c| {visual}c change the highlighted text |cc| N cc change N lines |S| N S change N lines |C| N C change to the end of the line (and N-1 more lines) |s| N s change N characters |v_b_c| {visual}c in Visual block mode: Change each of the selected lines with the entered text |v_b_C| {visual}C in Visual block mode: Change each of the selected lines until end-of-line with the entered text |~| N ~ switch case for N characters and advance cursor |v_~| {visual}~ switch case for highlighted text |v_u| {visual}u make highlighted text lowercase |v_U| {visual}U make highlighted text uppercase |g~| g~{motion} switch case for the text that is moved over with {motion} |gu| gu{motion} make the text that is moved over with {motion} lowercase |gU| gU{motion} make the text that is moved over with {motion} uppercase |v_g?| {visual}g? perform rot13 encoding on highlighted text |g?| g?{motion} perform rot13 encoding on the text that is moved over with {motion} |CTRL-A| N CTRL-A add N to the number at or after the cursor |CTRL-X| N CTRL-X subtract N from the number at or after the cursor |<| N <{motion} move the lines that are moved over with {motion} one shiftwidth left |<<| N << move N lines one shiftwidth left |>| N >{motion} move the lines that are moved over with {motion} one shiftwidth right |>>| N >> move N lines one shiftwidth right |gq| N gq{motion} format the lines that are moved over with {motion} to 'textwidth' length |:ce| :[range]ce[nter] [width] center the lines in [range] |:le| :[range]le[ft] [indent] left-align the lines in [range] (with [indent]) |:ri| :[range]ri[ght] [width] right-align the lines in [range] ------------------------------------------------------------------------------ *Q_co* Complex changes |!| N !{motion}{command}<CR> filter the lines that are moved over through {command} |!!| N !!{command}<CR> filter N lines through {command} |v_!| {visual}!{command}<CR> filter the highlighted lines through {command} |:range!| :[range]! {command}<CR> filter [range] lines through {command} |=| N ={motion} filter the lines that are moved over through 'equalprg' |==| N == filter N lines through 'equalprg' |v_=| {visual}= filter the highlighted lines through 'equalprg' |:s| :[range]s[ubstitute]/{pattern}/{string}/[g][c] substitute {pattern} by {string} in [range] lines; with [g], replace all occurrences of {pattern}; with [c], confirm each replacement |:s| :[range]s[ubstitute] [g][c] repeat previous ":s" with new range and options |&| & Repeat previous ":s" on current line without options |:ret| :[range]ret[ab][!] [tabstop] set 'tabstop' to new value and adjust white space accordingly ------------------------------------------------------------------------------ *Q_vi* Visual mode |visual-index| list of Visual mode commands. |v| v start highlighting characters } move cursor and use |V| V start highlighting linewise } operator to affect |CTRL-V| CTRL-V start highlighting blockwise } highlighted text |v_o| o exchange cursor position with start of highlighting |gv| gv start highlighting on previous visual area |v_v| v highlight characters or stop highlighting |v_V| V highlight linewise or stop highlighting |v_CTRL-V| CTRL-V highlight blockwise or stop highlighting ------------------------------------------------------------------------------ *Q_to* Text objects (only in Visual mode or after an operator) |v_aw| N aw Select "a word" |v_iw| N iw Select "inner word" |v_aW| N aW Select "a |WORD|" |v_iW| N iW Select "inner |WORD|" |v_as| N as Select "a sentence" |v_is| N is Select "inner sentence" |v_ap| N ap Select "a paragraph" |v_ip| N ip Select "inner paragraph" |v_ab| N ab Select "a block" (from "[(" to "])") |v_ib| N ib Select "inner block" (from "[(" to "])") |v_aB| N aB Select "a Block" (from "[{" to "]}") |v_iB| N iB Select "inner Block" (from "[{" to "]}") ------------------------------------------------------------------------------ *Q_re* Repeating commands |.| N . repeat last change (with count replaced with N) |q| q{a-z} record typed characters into register {a-z} |q| q{A-Z} record typed characters, appended to register {a-z} |q| q stop recording |@| N @{a-z} execute the contents of register {a-z} (N times) |@@| N @@ repeat previous @{a-z} (N times) |:@| :@{a-z} execute the contents of register {a-z} as an Ex command |:@@| :@@ repeat previous :@{a-z} |:g| :[range]g[lobal]/{pattern}/[cmd] Execute Ex command [cmd] (default: ":p") on the lines within [range] where {pattern} matches. |:g| :[range]g[lobal]!/{pattern}/[cmd] Execute Ex command [cmd] (default: ":p") on the lines within [range] where {pattern} does NOT match. |:so| :so[urce] {file} Read Ex commands from {file}. |:so| :so[urce]! {file} Read Vim commands from {file}. |:sl| :sl[eep] [sec] don't do anything for [sec] seconds |gs| N gs Goto Sleep for N seconds ------------------------------------------------------------------------------ *Q_km* Key mapping