Common vim commands in linux

Source: Internet
Author: User
Common vim commands in linux★In command mode www.2cto.com, move the cursor h or move the cursor to the left direction key (& amp; larr;) & amp; rarr; move the cursor to the left to move the character j or down? (& Amp; darr;) & amp; rarr; move the cursor down a character k or up? (& Amp; uarr;) & amp; rarr... common vim commands in linux★Command mode: www.2cto.com move the cursor h or move the cursor to the left direction key (direction) → move the cursor to the left of a character j or downward direction? (Cursor) → move the cursor down a character k or up? (Cursor) → move the cursor up to a character l or to the right? (→) → Move the cursor to the right with a character [Ctrl] + [f] → move one page down the screen, it is equivalent to [Page Down] pressing [Ctrl] + [B] → Moving a Page Up, equivalent to pressing [Page Up] n → N indicates a number 』. Press the number and then press blank ?, The cursor will move the n characters of this line to the right, 0 → number "0 』: move to the front character of this line $ → move to the last character of this line G → move to the last line of this file nG → n is a number. The nth row to be moved to this file (can be used with: set nu) gg → The first row to be moved to this file, equivalent to 1G n → N is a number. Move the cursor down n rows of www.2cto.com to search for and replace/word → search for a string named word under the cursor. To search for the eric4ever string, enter/eric4ever? Word → search for a string named word over the cursor → "repeat the previous search action" → opposite to n, perform the previous search action for "reverse: n1, n2s/word1/word2/g → n1 and n2 are numbers. Search for the word1 string between line n1 and line n2 and replace it with word2. For example, if you search for eric4ever between lines 1 and 9 and replace it with ERIC4EVER: ": s/eric4ever/ERIC4EVER/g": 1, $ s/word1/word2/g → search for the word1 string from the first row to the last row, and replace the string with word2: 1, $ s/word1/word2/gc → search for the word1 string from the first row to the last row, and replace the character window with word2, in the displayed dialog box before replacement, are you sure you want to replace, delete, copy, and paste x, X → in one line, x is backward? H apart from one character (equivalent to a [del] button), is X forward? H in addition to a single character (equivalent to a [backspace] Key) dd →? H divide the entire column ndd where the cursor is located → n is a number .? H in addition to the cursor's n-column-down yy → Copy the row of the cursor's nyy → n is a number. Copy the next n columns of the cursor p, P → p to paste the copied content on the next line of the cursor, P is pasted on the top line of the cursor u → restore the previous action [Ctrl] + r → redo the previous action. → Decimal point, meaning to repeat the previous action★Edit mode I, I → insert: Insert the input text at the position of the current cursor. The existing text will be backward. where, I is "insert from current cursor 』, I is the first in the current row ?? Insert non-blank characters. "a, A → a is" insert from the next character of the current cursor 』, A is "insert from the last character of the row where the cursor is located" o, O → o is "insert A new row at the next line where the current cursor is located 』, O is "insert a new row into the previous row where the current cursor is located" r, R → r is "replace the character where the cursor is located 』, R is the text that replaces the cursor until you press ESC. Esc → exit the editing mode and return to normal mode.★Last line command mode: w → write the edited file to the hard disk: q → Exit vi: wq → save and exit, if it is: wq! It is forcibly saved as exit: set nu → Display row number: set nonu → cancel display row number

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.