Im edit command summary

Source: Internet
Author: User
Im editing command summary 1. after VIM is highlighted and entered into vim, enter the following command in normal mode to enable php code highlighting: syntaxenable: source $ VIMRUNTIMEsyntaxphpvim common VI commands _________________________________ im edit command summary 1. after VIM highlights and enters vim, enter the following command in normal mode to enable php code highlighting: syntax enable: source $ VIMRUNTIME/syntax/php. vim 2. VI common commands _______________________________________________________________ General mode move cursor h or move a character j to the left direction key cursor or move a character k to the left direction key cursor or move a character l or move the cursor to the right with a character Ctrl + f. The screen is displayed one page forward (commonly used) ctrl + B move one page backward (commonly used) ctrl + d move the screen forward half page Ctrl + u move the screen backward half page + move the cursor to the next column of the non-space character-move the cursor to the previous column of the non-space character n Press the space key next to the number, and the cursor will move n characters in the line to the right, for example, 20 , The cursor will move 20 characters 0 to the right (this is the number 0) to the first character of this line (commonly used) $ move to the last character of this line (commonly used) h. move the cursor to the M line at the top of the screen. move the M cursor to the line in the center of the screen. L move the cursor to the G line at the bottom of the screen to move to the last line of the file (commonly used) nG moves to the nth line of the file. for example, 20 GB will be moved to the 20th rows of the file (can be used with: set nu) n Move the cursor down n rows (commonly used) ____________________________________________________________________________________________________________________________________________/word to search for a string named word before the cursor? Word searches for a word string named n1, n2s/word1/word2/g before the cursor and finds the word1 string between line n1 and line n2, replace this string with word2 (commonly used): 1, $ s/word1/word2/g to search for the word1 string from the first line to the last line, and replace this string with word2 (commonly used): 1, $ s/word1/word2/ge searches for the word1 string from the first row to the last row, replaces the string with word2, and displays a prompt for confirmation (confirm) before replacement) (commonly used) ______________________________________________________________________________________________________________________________________________ x, X x is to delete a Word Forward (Commonly used) nx delete n characters backward dd delete the entire line where the cursor is located (commonly used) ndd delete the next n rows of the row where the cursor is located, for example, 20 DD is to delete 20 rows (commonly used) d1G delete all data from the row where the cursor is located to the first row dG delete all data from the row where the cursor is located to the last row yy copy the row where the cursor is located (commonly used) nyy copies n rows down from the row where the cursor is located. for example, 20 YY copies 20 rows (commonly used) y1G copy all data from the row where the cursor is located to the first row. yG copy all data p from the row where the cursor is located to the last row. P p is the copied data and pasted on the next row of the cursor, P is pasted on the cursor over a row (commonly used) J combines the row where the cursor is located with the data of the next row into a row u restore the previous action (commonly used ____________________________________________________________ _______ I, I insert: Insert the input text at the position of the current cursor. The existing characters will be backward (commonly used) a, A added: the input starts from the next character at the place where the current cursor is located. The existing characters will be inserted to the backward (commonly used) o and O lines: enter the character (commonly used) r from the beginning of the next line at the cursor position. replace R: replace the character pointed by the cursor: r always replaces the text pointed by the cursor, wait until you press Esc (commonly used) to exit the editing mode and return to the general mode (frequently used). in the command line mode, ___________________________________________________________________________: w writes the edited data to the hard disk file (frequently used): w! If the file attribute is read-only, force write to the File: q exit vi (commonly used): q! If you have modified the file and do not want to save it, use it! To force exit without saving the file: wq is saved and then exited. if it is: wq !, After being forcibly saved, exit (commonly used): w [filename] saves the edited data as another File (similar to saving a new file): r [filename] in the edited data, to read the data of another argument, add the file filename to the end of the row where the cursor is located: set nu displays the row number. after setting, the row number is displayed before each row: set nonu is opposite to set nu. to cancel line number n1, n2 w [filename] saves content from n1 to n2 as filename.

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.