Vim skill collection

Source: Internet
Author: User
Vim Tips collection recently I like to look at vim's stuff. I collected some tips on the Internet and posted them to facilitate future search: Remove duplicates: www.2cto.com Method 1: sort: g/^ \(. \ + \) $ \ n \ 1/d Method 2: sortu delete some rows: Method 1: % s/regular expression /... vim Tips collection recently I like to look at vim's stuff. I collected some tips on the Internet and posted them to facilitate future search: Remove duplicates: www.2cto.com Method 1: sort: g/^ \(. \ + \) $ \ n \ 1/d Method 2: sort u delete some rows: Method 1: % s/regular expression // g Method 2 :: g/regular expression/d directly calls the Linux seq command in Vim to output 10, 11, 12 .... 20: r! Seq 10 20 (multiple rows) or: r! Echo {10 .. 20} (single line) the following command can operate on the content in the punctuation. Ci', ci ", ci (, ci [, ci {, ci <-modify the text content of these paired punctuation marks, di", di (or dib, di [di {or diB, di <-respectively delete the text content yi ', yi ", yi (, yi [, yi {, yi <-copy these pairs respectively. the text content vi ', vi ", vi (, vi [, vi {, vi <-respectively select the text content cit in these paired punctuation marks to delete a pair of HTML/XML tags all internal characters and enter the insert mode ci "ci 'ci' delete a pair of quotation marks (" or "or ') and enter the insertion mode. if the above I is changed to a, the pair punctuation can be connected.: Sh if you want to interact with the shell for a long time in the editing environment, use this to jump to the shell environment and return to the vim environment to exit :.! In the process of interaction, if we need to paste the execution result of the program directly to vim, of course, this is the current row in vim. (No experiment was successful before. it should be .!)!! In noraml mode, insert the external program output: line1, line2 d to delete line1, and include the text lines between line2.: Line1, line2 m line3 move the content package between line1 and line2 to line3.: Line1, line2 co line3: copy the content between line1 and line2 to line3. Set colorcolumn = 80 set cuc can be converted to uppercase using shift + letters in small writing: AB string1 string2 string2 is the content we originally entered, and string1 is the shorthand method we set: r filename: add the file to the bottom of the current row, and then press "n", and then press "shfit + j, in this way, the following n rows will be connected to the end of the current row, set cuc set cul. These two are enhanced line of sight effects. set autoindent Auto Indent set rdent set autoread auto read historyCtrl-A number + + Ctrl -X number -- normal mode: CTRL-X CTRL-F completion file name CTRL-X CTRL-L whole line completion CTRL-X CTRL-N CTRL-X completion CTRL-V completion vim command: mX move row current row move to row X: coX: tX copy row, the command to copy the current row to line X ''is quite useful. it moves the cursor to the previous tag, for example, after finding a word with gd, enter this command to return to the last position. '. this command moves the cursor to the last modified line. '. this command is quite powerful, it moves the cursor to the last modification point .. repeat the last edit command. gj and gk long lines move up and down. use the line breaks as one line to move and select the text to be counted. press g : G/search/# all the results are displayed with the row number Sex separated and the directory where the current file is located is displayed. E: The Directory where the current file is located: only close other windows in the current tab;: tabo [nly] close other tabs. The "gu" tab is changed to lowercase, and the "gU" tab is changed to uppercase, and the "g ~" tab is closed ~ Switch case. For example, the full text of ggguG is reduced to write. You can also use u U ~ in visual mode ~ To achieve the same function. G; jump the cursor in the latest modification order, g, similar to g; but in the opposite direction: v/test/d delete all rows that do not contain test in the current file: g/test/d delete all rows containing test in the current file. in Normal mode, press "gf" vim to open the cursor file, press "CTRL-^" Back to the previous position "q/" and "q? "Command: open a new window at the bottom of the vim window. this window will list your search history 'incsearch', indicating that when you enter the search content, vim starts matching the 'ignorecase' option to the content you entered, indicating that the case sensitivity is ignored during search. Go to normal mode, press find keyboard (/), and then click the mouse to select the desired content. the row number is automatically selected, and the menu bar editing-copy is enough.

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.