VIM Command Encyclopedia

Source: Internet
Author: User
Tags error code lowercase
VIM Command Encyclopedia


Vim found at the website of some of the commands of the collection, I organized a bit, and then added some examples and instructions, like Vim editor of children's Shoes please collection.
|h| N H Left (also: ctrl-h, or key) can also move n columns, for example: 12h
Take this example to illustrate |h| Represents the operator description N represents the number, and H is the operator. Example: 12h
Subsequent documents are read in this format and you will soon be able to master these commands and how to use them.
The instructions in the document are already clear, some will add some examples, others can look at the side of the operation
So learning will soon VIM in the left and right action


|h| N h Left (also: CTRL-H, <BS> or <Left>) You can also move n columns, for example: 12h
|l| N l Right (also: <Space> or <Right> key) l Move one column to the left, 12l Move to the left 12 columns
|0| 0 to the first character of the line (also: <Home> key)
|^| ^ to the first non-whitespace character of the line
|$| N $ to this line (plus N - 1 subsequent lines) Last character (also: <End> key)
|g0| g0 to the first character of the screen line (when the line wraps, it is different from "0")
|g^| g^ to the first non-whitespace character on the screen line (when the line wraps around and is different from "^")
|g$| N g$ to the last character of the screen line (when the line wraps around and is different from "$")
|gm| gm to the midpoint of the screen line
Wrap around: A long line is displayed in two lines
|bar| N | to column N (default: 1) Input: number + | (vertical line, jump to column number)
|f| N f{char} to the right Nth occurrence {char} Where (find) Example: 2ft
|F| N F{char} to the Nth occurrence of {char} on the left (Find) For example: 4Fh
|t| N t{char} to the right Nth occurrence {char} before (till) For example: 2tf
|T| N T{char} to the left Nth occurrence {char} (Till) For example: 2Th
|;| N ; Repeat the last "f", "F", "t" or "T" command N times, for example: 2;
|,| N , repeat the last “f”, “F”, “t” or “T” command in the opposite direction N times, for example: 2,
Up and down operation
|k|     N  k            Move up n rows (also: Ctrl-p and <Up>) Move up multiple lines: 10k
|j|     N  J Move Down            N rows (also: Ctrl-j, Ctrl-n, <NL>, <Down>)  Move Down Multiple lines: 12j
|-|     N  -            Move up n rows to the first non-white-space character
|+|     N  +            Move down n rows to the first non-white-space character (also: Ctrl-m and <CR>)
|_|     N  _            Move down the N-1 line to the first non-white-space character
| G|     N  G            to Nth line (default: Last line) first Non-white-space character
|gg|    N  GG           to Nth line (default: First line) first Non-white-Space character
| n%|    n  %            to full file rows N; n must be given, otherwise the |%| command
|gk|    N  GK           move n screen line (different from "K") Back-detour: A long line is displayed in two rows
|gj|    N           to move down the N-screen line (different from "J" when back to orbit)
Screen scrolling
| ctrl-e|        n  ctrl-e       windows roll down n rows (default: 1)        (Extra)
| ctrl-d|        n  ctrl-d       windows roll down n rows (default: 1/2 window) (downwards)
| Ctrl-f|        n  ctrl-f       window roll down N page                  (forwards)
| ctrl-u|        n  ctrl-y       windows roll N rows (default: 1)
| ctrl-u|        n  ctrl-u       window Roll n row (default: 1/2 window) (upwards)
| ctrl-b|        n  ctrl-b       window Roll n page                  (backwards)
|z<cr>|            Z<cr> or ZT  repaint, top of the current row window
|z.|               Z.    Or ZZ  repaint, the current row-window center
|z-|               Z    -or ZB  repaint, the bottom of the current line window

only takes effect when the ' wrap ' option closes:  wrap displays two rows when the line is too long.
| zh|            N  zh           screen right roll n characters
|zl|            N  Zl           screen left roll n characters
|zh|            N  ZH           screen right roll half screen wide
|zl|            N  zL           screen roll left half screen wide
text Object Action
|w| N w forward (forward, the same below) N words (word)
|W| N W Forward N blank separated strings |WORD| (WORD)
|e| N e forward to the end of the Nth word (end)
|E| N E Forward to the Nth blank separated string |WORD| The ending (End)
|b| N b backwards (reverse, same below) N words (backward)
|B| N B Backward to Nth blank separated string |WORD| suffix (Backward)
|ge| N ge backwards to the end of the Nth word
|gE| N gE Backward to the Nth blank separated string |WORD|


|)| N ) forward N sentences
|(| N (N backward sentences)
|}| N } forward N paragraphs
|{| N { N paragraphs backward
|]]| N ]] Forward N bars, placed at the beginning of the bar
|[[| N [[ Back N bars, at the beginning of the bar
|][| N ][ forward N bars, placed at the end of the bar
|[]| N [] backward N bars, placed at the end of the bar
|[(| N [( Backward to Nth unclosed '(' Note: this cursor is in) brackets
|[{| N [{ Backward to Nth unclosed '{'Note: This cursor is used in } brackets
|[m| N [m backwards to the beginning of the Nth method (for Java)
|[M| N [M Backward to End of Nth Method (Method) (for Java)
|])| N ]) Forward to the Nth unclosed ')' Note: This cursor is used in (brackets)
|]}| N ]} Forward to the Nth unclosed '}' Note: This cursor is used in { brackets
|]m| N ]m Forward to the beginning of the Nth method (for Java)
|]M| N ]M Forward to the end of the Nth method (Method) (for Java)
|[#| N [# Backward to Nth unclosed "#if" or "#else"
|]#| N ]# Forward to the Nth unclosed "#else" or "#endif"
|[star| N [* Backward to the beginning of the Nth comment "/*"
|]star| N ]* Forward to the end of the Nth comment "*/"
text Object (visual mode only or after operator)
|v_aw| N aw Select "a word" (a word)
|v_iw| N iw select "inner word" (inner word)
|v_aW| N aW Select "One String" (WORD)
|v_iW| N iW Select "included string"
|v_as| N as select "sentence"
|v_is| N is select "inclusive sentence"
|v_ap| N ap select "a paragraph" (paragraph)
|v_ip| N ip Select "Inclusion paragraph"
|v_ab| N ab Select "one block" (from "[(" to "])") (block)
|v_ib| N ib select "included block" (from "[(" to "])")
|v_aB| N aB Select "One big chunk" (from "[{" to "]}") (Block)
|v_iB| N iB Select "with large chunks" (from "[{" to "]}")
|v_a>| N a> Select "One <> block"
|v_i>| N i> Select "include <> block"
|v_at| N at Select "a label block" (from <aaa> to </aaa>) (tag)
|v_it| N it Select "Inclusive label block" (from <aaa> to </aaa>)
|v_a'| N a' Select "A single quoted string"
|v_i'| N i' Select "Include single quoted string"
|v_aquote| N a" Select "A double quoted string"
|v_iquote| N i" Select "with double quoted string"
|v_a`| N a` Select "A backquote string"
|v_i`| N i` Select "with backquote string"
Insert mode key
|insert-index|  Index of the Insert Mode command, leaving the insert mode in alphabetical order
:
|i_<esc>|       <Esc>             End insert mode, back to normal mode
|i_ctrl-c|      Ctrl-c            with <esc>, but not using abbreviations
|i_ctrl-o|      Ctrl-o {command}  and returns to insert mode

move:
|i_<up>|        Cursor key            left/right/up/down move cursor
|i_<s-left>|    Shift-left/right  left/right to move a word
|i_<s-up>|      Shift-up/down     after/before moving a full screen
|i_<end>|       <End>             cursor to the last character of the bank
|i_
inserting text
|a|     N  a    adds text after the cursor (n times)
| a|     N  A at the end of A line    add text (n times)
|i|     n  i    insert text before the cursor (n times) (also: <Insert>)
| i|     N  I    inserts text (n times) match either the first Non-white-space character in the current line
|gi|    N  GI   inserts text in the first column (n times)
|o|     N  o    start a new line below the current line, add text (n times)
| o|     N  O    start a new row above the current line, add text (n times)
|:startinsert|  : star[tinsert][!]   Start insert mode, add text when using [!]
|:startreplace|: startr[eplace][!]  Start the substitution mode, starting at the end of the line when using [!]
in Visual block mode:
|v_b_i|    I    Insert the same text before all the selected rows
|v_b_a|    A    to add the same text after all the selected rows
Delete Text
|x|     n  x            deletes the n characters below and after the cursor
|<del>| n  <Del>        Delete n characters below and after the cursor
| X|     n  X            deletes the n characters before the cursor
|d|     N  d{motion}    Delete text covered by Action {motion} For example: DW Deletes a word
|v_d|      {visual}d    Delete the highlighted text
|dd|    N  DD           Delete N line
| d|     N  D            Delete to end of line (and N-1 subsequent lines)
| j|     N  J            connection N-1 Row (delete <EOL>)
|v_j|      {Visual} J    -Connect highlighted row
|gj|    N  The           Same "J", but do not insert a space
|v_gj|     {VISUAL}GJ is the   same as ' {visual}j ' without inserting
a space |:d |    : [RANGE]D [x]   Delete rows covered by range [range] [deposited in register X]
undo/Redo Command
|u|       N  u          undo the latest n This change
| ctrl-r|  n  ctrl-r     Redo Recent n Undone Changes
| u|          U          restores recently changed rows
copying and moving text
|quote|   " {char}       Use register {char} |:reg|: Reg in the next delete, extract, or drop command to          display the contents of all registers
|:reg|    : reg {arg}    displays the contents
of register {arg} |y|       N  y{motion}  extracts text covered by action {motion} to a register
|v_y|        {Visual}y  extracts the highlighted text to a register
|yy|      N  yy         extract n line to register words: Copy one or more lines
| y|       n  Y          pull out n line to register words: Copy one or more lines
|p|       N  p puts the      contents of a register at the cursor position (n times) words: Paste
| p|       n  P          places the contents of a register before the cursor position (n times)
| p|      N  ]p         with P, but adjusts the indentation of the current line
|[ p|      N  [P         is the same as P, but the indentation of the current line is adjusted
|gp|      N  GP         with P, but leave the cursor behind the new text
|gp|      N  GP         with P, but leave the cursor behind the new text
Repeat command
|.|        N  .         Repeat last change (change Count to N)
|q|           Q{a-z}    record the characters you typed and save in register {A-Z}
|q|           Q{A-Z}    records typed characters, added to register {A-Z}
|q|           Q         termination record
|@|        n  @{a-z}    the contents of the Execute register {a-Z} (n times)
|@@|  N @@ repeat       the Last @{a-z} operation (n times)
|:@|       : @{a-z}      executes the contents of the register {a-Z} as an Ex command
|:@@|      : @@ 重复 Repeat last: @{a-z} operation
|:g|       : [Range]g[lobal]/{pattern}/[cmd]
    executes the
    Ex command [cmd] on all rows that match {pattern} in [Range] ( Default: ":p")
|:g|       : [Range]g[lobal]!/{pattern}/[cmd]
    executes the
    Ex command [cmd] for rows in [range] that do not _ match {pattern} (default : ":p")
|:so|      : so[urce] {file} reads the Ex command |:so| from files {file
}      : so[urce]! {file} reads Vim command from file {files}
|:sl|      : Sl[eep] [sec] does nothing in [sec] seconds
|gs|       N  gs        sleeps n seconds (goto sleep)
Visual Mode
|visual-index|  A list of visual mode commands.
|v|        V            to start highlighting in characters             }  move cursor or use
| v|        V            to start highlighting in row mode               }  operator for
| ctrl-v|   Ctrl-v the highlighted       text as a column             block
|v_o|      o            swap the start and cursor position of the highlight area
|gv|       GV           uses the last visible area to start highlighting
|v_v|      V            to start highlighting or stopping highlighting
|v_v|      in character mode V            to start highlighting or stopping highlighting |v_ctrl-v| in line mode
Ctrl-v       start highlighting or stopping highlighting as a column block
Write and Exit
|:w| :[range]w[rite][!] Write the current file
|:w_f| :[range]w[rite] {file} is written to file {file} unless it already exists
|:w_f| :[range]w[rite]! {file} Write to file {file}. Overwrite existing files
|:w_a| :[range]w[rite][!] >> Add to current file
|:w_a| :[range]w[rite][!] >> {file} Add to file {file}
|:w_c| :[range]w[rite] !{cmd} Execute the command {cmd}, with the line [range] qualified
                                           Standard input
|:up| :[range]up[date][!] Write if the current file is changed
|:wall| :wa[ll][!] writes all changed buffers

|:q| :q[uit] Exits the current buffer unless it has been changed. If there is no other
                                   Unhelpful buffer, exit Vim
|:q| :q[uit]! Forces the current buffer to exit and discards all changes. Without it
                                   It's a non-help buffer, exit Vim
|:qa| :qa[ll] Exit Vim unless changed
|:qa| :qa[ll]! Exit Vim and discard all changes
|:cq| :cq exits, does not write to the file and returns an error code

|:wq| :wq[!] writes the current file and exits
|:wq| :wq[!] {file} write to file {file} and exit
|:xit| :x[it][!] [file] Same as ":wq" but only if there are changes
|ZZ| ZZ with ":x"
|ZQ| ZQ with ":q!"
|:xall| :xa[ll][!] or :wqall[!]
                                Write all changed buffers and exit

|:stop| :st[op][!] Suspend Vim or start a new shell. If 'aw' is set
                                   The option does not give [!] to write to the buffer
|CTRL-Z| CTRL-Z with ":stop"
Collapse
|'foldmethod'| set foldmethod=manual Manual folding
                Set foldmethod=indent folded in indentation
                Set foldmethod=expr is folded according to the expression 'foldexpr'
                Set foldmethod=syntax folding according to the syntax area
                Set foldmethod=marker Fold by the flag 'foldmarker'

|zf| zf{motion} Operator: Manually define a fold (fold)
|:fold| :{range}fold defines the line included in the range {range} as a fold
|zd| zd delete a fold under the cursor (delete)
|zD| zD Delete all folds under the cursor (Delete)

|zo| zo Open the fold under the cursor (open)
|zO| zO Open all folds under the cursor (Open)
|zc| zc closes a fold under the cursor (close)
|zC| zC Close all folds under the cursor (Close)

|zm| zm fold more: reduce 'foldlevel' (more)
|zM| zM Close all folds: Set 'foldlevel' to 0
|zr| zr Reduce folding: increase 'foldlevel' (reduce)
|zR| zR Open all folds: set 'foldlevel' to maximum

|zn| zn does not collapse: reset 'foldenable' (none)
|zN| zN Normal folding: Set 'foldenable' (Normal)
|zi| zi Invert 'foldenable' (invert)
Multi-Window command
|CTRL-W_s| CTRL-W s or :split splits the window into two parts (split)
|:split_f| :split {file} Separates the window and edits one of them in {file}
|:vsplit| :vsplit {file} Same as above, but vertically split
|:vertical| :vertical {cmd} makes the command {cmd} split vertically
|:sfind| :sf[ind] {file} Split window, find file from {path}
                                           {file} and edit it
|CTRL-W_]| CTRL-W ] Split the window and jump to the label under the cursor
|CTRL-W_f| CTRL-W f Split the window and edit the file name under the cursor (file)
|CTRL-W_^| CTRL-W ^ Split the window and edit the rotation file
|CTRL-W_n| CTRL-W n or :new Create a new blank window (new)
|CTRL-W_q| CTRL-W q or :q[uit] Exit editing and close the window (quit)
|CTRL-W_c| CTRL-W c or :cl[ose] hides the current buffer and closes the window (close)
|CTRL-W_o| CTRL-W o or :on[ly] makes the current window a unique window (only)

|CTRL-W_j| CTRL-W j Jump to the lower window
|CTRL-W_k| CTRL-W k Jump to the top window
|CTRL-W_CTRL-W| CTRL-W CTRL-W Move the cursor to the lower window (twist) (Wrap)
|CTRL-W_W| CTRL-W W Move the cursor to the upper window (twist) (wrap)
|CTRL-W_t| CTRL-W t Jump to top window (top)
|CTRL-W_b| CTRL-W b Jump to the bottom window (bottom)
|CTRL-W_p| CTRL-W p Jump to the last active window (previous)

|CTRL-W_r| CTRL-W r Rotate the window down (rotate)
|CTRL-W_R| CTRL-W R Rotate the window up (Rotate)
|CTRL-W_x| CTRL-W x Aligns the current window with the next window (eXchange)

|CTRL-W_=| CTRL-W = Make all windows contoured
|CTRL-W_-| CTRL-W - reduce the current window height
|CTRL-W_+| CTRL-W + Increase the current window height
|CTRL-W__| CTRL-W _ Set the current window height (default: very high)
Change Text
|~|       n  ~          Flip N-character case and forward cursor
|v_~|        {visual}~  Flip the case of the highlighted text
|v_u|        {Visual}u  the highlighted text as lowercase
|v_u|        {Visual} U  Change highlighted text to uppercase
|g~|         G~{motion} Reverses the case of text overwritten by action {motion}
|gu|         Gu{motion} changes the text overwritten by the action {motion} to lowercase
|gu|         Gu{motion} changes the text overwritten by the action {motion} to uppercase
|v_g?|       {visual}g? Do ROT13 coding for highlighted text
|g?|         G? {Motion} ROT13 encoding for text covered by action {motion}

| ctrl-a|  n  ctrl-a     Increase the value above or beyond the cursor N
| Ctrl-x|  N  ctrl-x     to reduce the number above or beyond the cursor n
Change Text
|<|       N  <{motion}  moves all lines covered by action {motion} to the left by one shift width
|<<|      N  <<         move n rows to the left one shift width  For example: Ctrl + V selects N rows,>>
|>|       N  >{motion}  moves all lines covered by action {motion} to the right by one shift width
|>>|      N  >>         move n rows to the right one shift width
|gq|      N  gq{motion} to format all lines covered by action {motion} to ' textwidth ' width
|:ce|     : [Range]ce[nter] [Width]
                        range [Range] Included lines are centered
|:le|     : [range]le[ft] [indent] aligns the
                        rows in the range [range] to the left (using [indent])
|:ri|     : [range]ri[ Ght] [Width]
                        aligns the rows in the range [range] to the right
Complex Changes
|!|        N  !{ Motion}{command}<cr>    The rows that are covered by the action are filtered with the command  ' {command} '
|!!|       N  !! {command}<cr> the N rows with the commands {command} filter
|v_!|         {visual}! {command}<cr>    Filters the highlighted rows with command {command}
|:range!|  : [range]! {command}<cr>  The rows included in the range [range] with the commands {command} filter
|=|        N  ={motion} Filters the rows covered by the action with ' EQUALPRG '
|==|       n  = =        to filter n rows with ' EQUALPRG '
|v_=|         {visual}= will highlight rows with ' EQUALPRG ' filter
|:s|       : [range]s[ubstitute]/{pattern}/{string}/[g][c]
    Replace range with {string} [ Range], {pattern} in the line included,
    with [G] shared, substituting all occurrences of {pattern}; shared with
    [C], confirming each substitution
|:s|       : [Range]s[ubstitute] [ G][c] Repeats the last ": S" command with the new range and options
|&|           &         Repeat the last ": S" command on the current line without options
|:ret|     : [range]ret[ab][!] [TabStop] Place ' tabstop ' as the new value and adjust the white space character according to this value
Pattern Lookup
|/| N /{pattern}[/[search-offset]]<CR> search-offset This will be introduced later
                         Look forward to the Nth place where {pattern} appears
|?| N ?{pattern}[?[search-offset]]<CR>
                         Find the Nth place where {pattern} appears backwards
|/<CR>| N /<CR> Repeat the last lookup forward
|?<CR>| N ?<CR> Repeat the last lookup
|n| N n Repeat last lookup
|N| N N Repeat the last lookup in the opposite direction
|star| N * Find the identifier under the cursor forward
|#| N #Find back the identifier under the cursor
|gstar| N g* Same as "*" but also find partial matches
|g#| N g# with 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.