Vim shortcut key Encyclopedia _linux Shell

Source: Internet
Author: User

VI (VIM) is a very popular editor on Linux, many Linux distributions are installed by default VI (VIM). VI (VIM) command a wide range but if used flexibly will greatly improve the efficiency. VI is "visual interface" abbreviation, VIM is VI improved (enhanced version of VI). In general system Management Maintenance VI is enough, if you want to use the code highlighting can use Vim.

VI has 3 modes: insert mode, command mode, low line mode

1 Insert mode: You can enter characters in this mode, press ESC to return to command mode.

2 Command mode: Can move cursor, delete character and so on.

3 Low Line mode: can save files, exit VI, set VI, Look for functions (low line mode can also be seen as the command mode).

below to introduce Vim shortcut key encyclopedia.

#vim filename

: ScriptName//View what scripts are loaded by vim

: Set nu//Set line number

: Set tabstop=4//Set a tab to 4 space length

: Set AI//Set auto Indent

Space bar//Move one grid to the right

X//delete the following characters (in command mode)

X//Delete previous character, delete three characters is 3x

DD//Delete line

D//Delete to end of line

CAW//rewrite word, C equivalent D to edit mode

J//delete line break, make the next line and come up, NJ connect the following n lines

U//Undo Last action

U//Undo all changes to the current line

Ctrl+r//Revocation of revocation

I//insert in front of the cursor

I//Inserts at the beginning of the line

A//AT cursor insertion

A//Insert at end of line

O//Another line below the current line and becomes insert mode

O//Another line above the current line, into insert mode

Ctrl+o//temporary Change to command mode (once in effect)

: e! Discard changes, which is equivalent to reopening

: Help//help, use ZZ to exit the assistance window

: 10,20y//Copy 10 to 20 lines or 10YY/YY10

: 10,20d//delete

: 10,20 M 30//10 to 20 lines of content, cut to 30 lines

: 10,20 Co 30//10 to 20 lines of content, after copying to 30 rows

Place the cursor in {, and then enter v% to select the contents of the curly braces

If the cursor is placed on the first S and wants to Delete to "("), then the input dt is OK, t (the function is to skip to the next "(")

CTRL + N automatic complement ctrl+p also the same

: AB HW Hello World replaces a long string with an abbreviation here with HW instead of Hello World

#到与当前单词相同的上一个单词

* To the next word that is the same as the current word

The above is a small set to introduce the Vim shortcut key encyclopedia, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.