Vim editor details

Source: Internet
Author: User

Vim editor details
The vim editor is an enhanced version of the vi editor. The vim editor is a full-screen mode editor. Vim mode has three modes: edit mode (command mode) input mode end-line mode conversion: Edit --> input I: Before the character of the current cursor, convert to input mode: after the character of the current cursor, convert it to input mode o: Create a new row under the row where the current cursor is located and convert it to input mode I: convert the beginning of the row where the current cursor is located to input mode A: at the end of the row where the current cursor is located, convert it to input mode O: create a new row above the row where the current cursor is located and convert it to input mode input --> EDIT: ESC edit --> last line: Last line --> EDIT: ESC, ESC 1. open the file (in editing mode by default) # vim/path/to/somefile vim + n: open the file and locate vim + in line n: open the file and locate the last line of vim +/pattern: open the file and locate the first line of the content matched by pattern for the first time. 2. Close file 1. close the file in the last line mode: q: Exit wq and save and quit q! Do not save exit w save w! Forcibly save wq --> x save and Exit 2. edit mode close file: ZZ save and exit 3. move cursor 1. Move character by character: h: left l: Right j: down k: up # h: Move to left # character 2. Move in Word unit: w: Move to the First e of the next word: jump to the current or next word's end B: Jump to the current or previous word's first word # w: Move to # Word's first 3, line jump: 0: first line of the absolute line ^: the first non-blank character at the beginning of the line $: End of the absolute line 4. jump between lines: # G: Jump to the first line # Line G: Jump to the last line gg: jump to the first line 4. Press ctrl + f: press ctrl + B: press ctrl + d: press ctrl + u: flip up half screen 5. delete character: x: delete a single character at the cursor position # x: Delete the cursor position and back # character 6. delete command: d command and jump command used in combination # d jump character: delete # Jump characters in the specified range, for example: # dw, # de, # db dd: delete the row where the current cursor is located # dd: Delete the package # StartADD and EndADDd at the end of the row, including the row where the current cursor is located.: indicates the current row $: the last row + #: downward # Line $-#: penultimate # Line 7. paste command: pp: If the row content is deleted or copied, paste to the bottom of the row where the cursor is located. If the deleted or copied content is not an integral line, paste it to the end of the character where the cursor is located P: If the deleted or copied content is an integral line, paste it to the top of the cursor row. If the deleted or copied content is not a whole line, paste it to the front of the character where the cursor is located. Copy command: y command: Same as d command 9. modify, delete the content first and then convert it to the input mode: c: use the same as d command 10, replace: r R: replace mode, replace multiple characters r #: replace the character of the current cursor with #, here # can be any character eleven, cancel the edit operation: u: undo the previous edit operation consecutive u command to undo the previous n edit operations # u: directly undo the latest # edit operation ctrl + r: restore the last Undo operation 12. Repeat the previous edit operation :..: Repeat the previous edit operation 13. Visual mode v: select by character V: in the visualization mode of selecting by rectangle blocks, you can edit the selected content. 14. Search/pattern: Search from top to bottom? Pattern: Find n N n from the bottom up. Search for and replace it with the s command ADDR1 in the last line mode, ADDR2s @ pattern @ string @ gi, edit multiple files vim file1 file2 file3: next switch to the next file: prev switch to the previous file: last switch to the last file: switch first to the first file: Exit all qa and display a file on the split screen (here, press ctrl + * and then press ctrl + w, s: horizontal Split Window btrl + w, v: vertical split window switch cursor between windows: horizontal split window: ctrl + w, ARROW Vertical Split Window: ctrl + w, left and right arrows: qa closes all windows 18. edit multiple files in a window. vim-o file1 file2 horizontal split display vim-O file1 file2 Vertical Split display 19. save part of the current file as another file run the w command in the last line mode:: W: ADDR1, ADDR2w/path/to/somewhere 20. Fill the content of another file in the next row of the current cursor in the current file: r/path/to/somefile 21. Interaction with shell :! COMMAND 22, advanced function 1, show or cancel display row number: set nu display row number: set nonu cancel display row number 2, show ignore or case sensitive: when the set ic display ignore character case: set noic display time zone (uppercase/lowercase) 3. set automatic indent: set autoindent: set ai: set noai4. Find the text highlighted or unhighlighted: set hlsearch highlighted: set nohlsearch unhighlight 5. syntax highlight: syntax on: syntax off 23. configuration file. The advanced functions mentioned above can be configured in the following configuration file:/etc/vimrc ~ /. Vimrc

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.