Use of the Vi/vim editor

Source: Internet
Author: User

Enter Vi/vim VI/vim filename three modes of Operationtext editing mode:  I,a,o into the text editor, press ESC to exit the text edit and convert to command mode.  1) I insert text at the cursor location.  ·2) a The text is inserted at the next position where the cursor is located. ·3) o Insert a new line, and then insert the text at the beginning Command mode:  1) I a O enters text editing mode.  ·2) cursor movement, direction key: H left, J, K, L right • 3) position shortcut: Ctrl+b page backward ctrl+f backward shift+? • W move to the beginning of the next word • E move to the end of the next word ・the move to the beginning of the previous word • 0 (0) move to the beginning of the line where the cursor is located Bottom line command mode:   Press shift+: Convert to End line command mode: • 1) Wq: Save exit • 2) W: Save current content to file • 3) Q: Exit • 4) q! : Forced exit • 5)/name: Find name content • 6) Press/n spaces: Uncheck the character/string 7) Set NU list line number set Nonu Cancel line number 8) C-style indentation, set tabstop=3. Set tab Indent distance • 9) jump to the specified Line: Line number + carriage return • 10) Replace string%s/original string/string to replace/g 11) Keep production new file Number1,number2 w newfilename line number 1, line number 2 save new file name• Delete text• Small x: Delete a character after the cursor position • Large x: Delete one character before the cursor position n+x (small): Delete the n characters after the cursor position n+x (Large): Delete the n characters that precede the cursor position DD: Delete the line where the cursor is located n+dd: Delete the line with the cursor and the following five lines. (from the line where the cursor is located to the following five lines (including the cursor line))• Copy and pasteyw: Copies the current cursor at the end of the word to the buffer.  yy: Copies the row of the current cursor into the buffer.  n+yy: Copy the row of the current cursor to the following n rows into the buffer (including the line where the cursor is located) p paste: Pastes the contents of the buffer into the position where the cursor is located. • 6, replace (replace) • R the character at which the cursor is located • R always replace until you press ESC• Restore Undo• U Revocation• Jumps to the specified line. Ctrl+g Lists the line number of the line where the cursor is located n+g jumps to n rows, does not exist 0g, that is, there is no 0 line one said.

Use of the Vi/vim editor

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.