Vim basic commands

Source: Internet
Author: User

Vim basic commands

Leave ViZZ: WQ: X Archive before leaving: W archive name into his archive: Q quit (will prompt if the archive is changed): Q! Quit editing and leave: WQ! Force archiving and exit
Leave Vi temporarily:! Temporarily execute the Unix Command: Sh to generate a new shell, CTRL + d go back to the original editing location Ctrl + Z ?? Back to the previous shell and use the FG command to return to VI
Insert/Command mode switchingESC key insertion mode --> command mode
Commands in command modeA insert text to the right of the cursor I insert text at the cursor o add new column A below the cursor insert text at the end of the column I insert text at the beginning of the column of the cursor o add new columns above the cursor
Move cursorK move up j Move Down h move to left l move to right ^ move to first column $ move to end of column W move one word to right B move one word to left) E move the last character G of the current word to the end of the file ng move to column N: N cursor move to column N: $ move cursor to the last column H cursor to the top of the screen M cursor to the center of the screen l move cursor to the bottom of the screen Ctrl + D cursor to the bottom half page Ctrl + u cursor to the upper half page Ctrl + F cursor roll up one page Ctrl + B cursor roll down one page
DeleteCTRL + G query current cursor position delete data x Delete cursor character (delete) # x start from the cursor, delete # character x Delete cursor first field (backspace) # X from the cursor, delete # One character DW (Word) # DW Delete # Word) d. Delete the word to the end of the column dd Delete the entire column # DD starts from the cursor column, delete # column DG deletes from the cursor to the end of the file
Cut and copyThe NDD starts n columns from the cursor and is cut to nyy in the temporary storage area and starts n columns from the cursor. Copy the temporary storage area P and paste the content of the temporary storage area to the cursor n, m co x copies data from N to M columns to N in column X, and m x copies data from N to M columns to column X ., $ Co x: copy the cursor column to the end of the file to column X.
Search and substitution/String SEARCH: case-insensitive for set IC search: when searching for set noic, consider case-insensitive N-downward search N-upward search R: Replace the cursor with another one-field CW to replace one string CC to replace one full column: s to replace multiple strings: 1, $ S/old string/New String/G 1 is the 1st column, $ is the last column, and G is the full file. For example, the following command sets all: B :... z: string to *: 1, $ S/[A-Z]:/*/g
Merge columns/ArchivesJ. merge two columns: R file names inserted in the column where the cursor is located: NR ?? File names inserted after column N
RollbackU cancels all modifications made to this column by the previous command (UNDO) u
Set: Set nu plus row number: Set Nonu does not show row number
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.