Common vi command collection

Source: Internet
Author: User
Common vi command Collection 1. Insert command a after the cursor append text A at the end of the cursor line I insert text before the cursor I insert text at the beginning of the line o insert new lines under the cursor O insert a new line on the cursor 2. position command h to move one character to the left j move one down... info & nbsp; | & nbsp; common vi command Collection 1. Insert command a after the cursor append text A at the end of the cursor line I insert text before the cursor I insert text at the beginning of the line o insert new lines under the cursor O insert a new line on the cursor 2. locate command h move one character j move one line down k move one line up l move one character H move to the top of the screen M move to the center of the screen L move to the bottom of the screen $ move to the line move the last 0 to the beginning of the Line 3. delete the command www.2cto.com x delete the character nx where the cursor is located delete the n characters dd after the cursor is located delete the line ndd delete n lines dG delete the row where the cursor is located delete n lines d. delete the content at the end of the cursor to the end of the line: n1, n2d delete rows within the specified range 4. copy and cut commands yy, Y Copy n rows below current Row dd cut current row ndd cut n rows below current row p, P paste below current row or row 5, replace and cancel the command r to replace the character R where the cursor is located. replace the character r from where the cursor is located, press Esc to end u to cancel the previous step. 6. search and replace command function./When string is searched for the specified string, case sensitivity is ignored. set ic n searches for the next occurrence location of the specified string: % s/old/new/g replace the specified string in full text (g indicates confirmation, c indicates not confirmation): n1, n2s/old/new/g replace the specified string within a certain range (g indicates confirmation, c indicates not confirmation) 7. save exit command: ZZ save quit: wq! Force save and exit (administrator Root, file owner): q! Do not save exit www.2cto.com: w save do not exit 8, application instance: r file name File Import :! Command in vi execute command: map shortcut key trigger command definition shortcut key (for example, map ^ B 0x delete the first character of the line): n1, n2s/^/#/g continuous line comment (add # at the beginning of the n1-n2 line): n1, n2s/^ # // g remove the beginning of the n1-n2 line #: n1, n2s/^/\ // g add at the beginning of the n1-n2 line //: AB ck liyfh@ufida.com replacement (when ck is entered with a space or wrap ck with a liyfh@ufida.com ): unab ck cancels the definition of AB
Author: android. google

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.