Vim Editor Notes

Source: Internet
Author: User

Vim Editor Command mode (default), tail line mode:/Two ways (ESC slow, continuous conjunction ESC, delete all tail line content), edit mode A,i,o,s:q exit Edit does not save: Wq save Edit and exit: W Save and write content: q! Force quit, do not save changes: wq! Force Save and exit, (some documents can be enforced without permission actions): w [filename] Save the file a name filename:r [filename] Adds the filename file contents to the cursor row: n1,n2 w [filename] Save the N1 line to the N2 line document as a filename file: Set number or set Nu sets line numbers for each line of the editor: set Nonumber or set Nonu do not display line numbers:/content/Content lookup (lowercase n Find Next, uppercase N find previous)/inside Tolerant/This method can also use lowercase n to find the next, size n to find the previous? Word searches for a word's character n on the cursor. N repeats the previous search in the opposite direction search: s/replaced/replaced replaces the first content of the current line: s/replaced/replaced/g replacement "All the current rows are matched" content:%s/replaced/replaced/g replaces the entire document matches the content: The number cursor positioning command mode: The word level e this word or the end of the next Word prompt b This word or the beginning of the last Word prompt w next word start character row level $/function End Line End 0/ Function key home header paragraph level} This paragraph or the end of the next paragraph {this paragraph or the first screen level of the previous paragraph (this screen) l screen tail H screen header document-level G document tail 1G or GG document header ng document Nth row move cursor: Move the number of rows more than once, such as moving down 30 rows, 30j or 30 ↓ The combination CTRL + F screen moves down one page, equivalent to page Downctrl + B screen Move up one page, equivalent to page Upctrl + D screen Move down half page Ctrl + U screen Move up half page n<space> that n represents a number, for example 2 0, press and then press the blank key, the cursor will move to the right of this line of n characters n<enter> N is a number, the cursor moves down n line h cursor moves to the top of this screen the first character m cursor moves to the center of the screen the first character of the line L The cursor moves to the first character of the line at the bottom of the screen: n1,n2s/word1/word2/g n1,n2 is a number, N1 is looking for word1 characters between N2 lines, and Word2 replaces theValue: 1, $s/word1/word2/g from the first line to the last line to find Word1, and replace the value with Word2:1, $s/word1/word2/gc in the replacement, to confirm to the user, whether it is necessary to replace (personally feel very useful) Delete, copy, paste operation X,x lowercase x, remove one character backward (including the current character), uppercase X, and delete one character (excluding the current character). NX N is a number, successive n characters are deleted, or you can use DD with uppercase X to delete the current line n+dd from the current line to delete n rows (including the current row) d1g Delete all data in the first row of the cursor the DG deletes all the data from the last row of the cursor d$ deletes the last character of the cursor to the line D0 deletes the cursor at the top of the row, copying YY copies the current line Nyy starting from the current line to copy the n rows y1g copy the first line of the document YG Copy the current line y0 copy the current character to all content at the beginning of the line, not including the current character y$ copy the current character to the end of the line, contain the current character p,p lowercase p, paste to the next line of the current line, uppercase P, paste the previous line of the current line J Capital J, the current row and the next line into a row of Delete multiple data, for example, delete 10 line 10CJ, plus the current line is 11 rows, after deletion, into the edit mode u revert to the previous action Ctrl+r (.) Redo the previous action, using the decimal points. Operation can be ZZ This is the capital Z, if not modified, do not save leave, if modified, then save leave (should be very cool) Block Selection v character selection, will be the cursor through the selection of the V-line selection, and the same as above the CTRL + V. Block selection, you can select the area of the selected document Y to copy D Remove the selected area from multiple document editing: n Edit the next document: N Edit the previous document: Files lists all of the current vim-open documents: SP water Separation window (also open a new file): vs Vertical Splitter (can also open a new file) ctrl+w+ (up/down) switch window , you can also use Ctrl+wwctrl+w+q to end the exit into edit mode: i,i cursor insertion, before the current cursor, I in the target row first non-null character inserted a,a A for the target cursor to start inserting the next character, a for the cursor row at the last character start insertion ( Current end of line insertion) O,o o Inserts a new row at the next line of the target row, capital O inserts a new line on the line that contains the target row s,s S deletes the current cursor character, enters edit mode, caps S, deletes the current line, enters edit mode R,r R replaces the character of the current cursor, R will always replace the text in which the cursor is located until ESC is pressed (replace for short). Point, repeatLast command 

Vim Editor Notes

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.