Vim Editor Common Command Description __ Tool class

Source: Internet
Author: User
Tags diff
No: Drop the option before a Boolean option, such as set number, set Nonumber custom vim:: Edit ~/.VIMRC Add your own command at the end of the command line, such as highlighting search results move the cursor H J k L Delete Delete whole line DD except character X
The two lines are merged into one row, which is to delete the line break between the two lines: J move to the beginning and end of the line by moving W 3w in Word ^ $ move to the specified character FX to find the next X character (f means found), such as FL 3fl
F Search to the left direction, such as Fh matching (), [],{} bracket% move to the specified line text the first GG text tail g specify line 34G (g to go) tell the current position ctrl+g roll to Ctrl+u to scroll the text down Half screen, you can also imagine that in the display text of the window to scroll up half screen ctrl+d the window to move down half screen, which is equivalent to the text scroll up to a half screen simple search/string, such as/include, special characters:. *[]^%/?~$, the search string contains these characters to be placed before the character Place a backslash, find the next press N, and find the third occurrence of the input "3n". “。 The command is the same as the/command, except that the search is in the opposite direction.
The cursor is on word and the "*" key is pressed, and Vim takes the word that is at the current cursor and searches it for the target string. The "#" command is a reverse version of the "*" command. You can also use the command count, such as "3*" to find the third occurrence. /ab*, Matching ab,abb,abbb,/\ (ab\) * &NBSP;, matching ab,abab,ababab;/ab\{3,5}, number of matches;/one\|two\|three, or matching;/the\nword, matching newline;/\< word\>,\< and \> match a word; Ignore case  :set ignorecase    :set noignorecase Highlight search results  : Set Hlseyrch &NB Sp : Set nohlsearch Conditioning Search command  : Set Incsearch   In the process of typing the target string, Vim starts the search at the same time, pressing ENTER to jump to the current match to the position between two positions jump command: ', because ' Is the position representing the last command line, and the Jump command also includes:/, N. The ": Jumps" command lists the list of places that have been skipped, and the last jump position is specifically marked with a ">" sign. Name tag: MA: The current row is defined as a tag, you can define a A-Z altogether 26 tags, and jump to a tag "a"; ": Marks" command to see some special tags. The "D" command followed by a displacement command to delete the cursor to the end of the content. For example: dw,d4w (delete 4 word), d$ delete the cursor to the last, Daw delete a word in the middle of the word (delete a word) CW: After deleting a word and being in insert mode, the behavior is similar to DW (C1 change one character, C is changing meaning) ; DD deletes the entire row, CC changes the entire line; d$ deletes the cursor to the end, C $ changes the cursor to the line end content, 3d2w deletes 2 words, repeats 3 times, deletes 6 words, and the R command replaces one character without using ESC; x   represents D1 (deletes the character under the current cursor)  x On behalf of DH (delete the character to the left of the current cursor) d is for d$ (delete to the end of the line) C is on behalf of (Modify to the end of the line) s on behalf of C1 (modify one character)  s on behalf of CC (Modify an entire line) "." In normal mode, the command repeats the last operation, such as/four, executes the cwfive,n (find the next foure), enters ".", and continues to replace four for five v into Visual mode, which can passThe arrow keys control the area selection, and then use D or x command to delete, use CTRL + V to copy, copy text use Yy+p,y is yanking, put to register; P is the meaning of putting; y$ copy cursor to last;: Set list   can clearly see " $ "Line break and Tab with" ^i ": split,:vsplit separator window, Toggle window Ctrl+w + (h/j/k/l/t/b), T: to the top window; b: Bottom window; ctrl+w+k: Window up;: Qall   All exits;: Wall   all write save;  :wqall saves all the modified files and exits; Vimdiff a.txt b.txt The difference between displaying two files vertically, you can compare the diff command.  ]c: Navigate to the next difference, [C: Navigate to the previous difference; replace,: [Range]substitute/from/to/[flags]   s replace substitute  ,:%s/professor /teacher/g   Replaces all rows, such as replacing a row:: s/from/to/g, replacing all rows::%s/from/to/g, from can regular expressions, such as replacing the beginning of the line with the these,:s/^the/these/. If there is a slash/in the replaced character, you need to increase the backslash in front, more elegant method:: s+one/two+one or two+   function in range:: 1,5s/this/that/g. Replace only 54 lines:: Use of the 54s/president/fool/tag, use MB to mark the current behavior tag B, use ' B to position the cursor to the tag: Read filename   Append the contents to the current line; : Read!ls (read the current directory file),! Indicates that the following is a command, and if the action subcommand is to act on the unit of behavior, type the operation two times, such as Dd,gg,gudu (line lowercase), Gugu (shorthand Guu) to compare the file's commands, Diff,vimdiff view history commands , such as ":se<up>", you can view the history command Vim-x exam.txt   Encrypt the file, or: X View the current line information, including the number of bytes G ctrl-g insert mode, ctrl-w delete a word, ctrl-u delete the current row; Trl-p (PrevioUs-match) Search the first word from the previous text and complement it; Ctrl-n (next-match) look down the first word and get it;%s/\<very\>/wuguowei/g match very words, "\<" and "/>" Indicates that only the complete word will be matched ls | Vim-    "VIM-" indicates that Vim's stream from the standard input is the edited content; such as PS |vim-zf: Create a folded line, Zo: Open a folded line, Zc: close the folded line; the lines related to the command are all started with Z, and Z looks like a piece of paper folded up. Z-word end-of-file is an easy to remember command. Fold a paragraph zfap, open for ZO;ZF can be matched with any displacement command to create a folded line;
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.