Common commands for VIM tools in Linux

Source: Internet
Author: User
Tags command line split linux

Under Linux to do development, and even only do management maintenance work, but also the use of vim. As a novice, I have just come in contact with this section of my daily use or collection of vim commonly used commands recorded.

Of course, just enter on the command line: Vimtutor, you can learn all the commands of vim. Vim is very powerful, many cows in the vim integration of many plug-ins what, but here only the basic VIM command.

Move command

H "left

J "under

K "On

L "Right

W "Cursor moves to the first character of the next word a word forward

B "Cursor moves to the first character of the previous word

E "cursor moves to the end character of the next word

GE cursor moves to the end character of the previous word

$ "Moves the cursor to the end of the current line line

^ "Moves the cursor to the first non-white-space character on the current line

"Moves the cursor to the first character in the current line

Note: These commands, in addition to the ' 0 ' command, can be preceded by a count of 2$; All commands above can be preceded by some operation commands, such as D$,DW.

Modify command

X "Delete a character

D "followed by any displacement command, will delete the text from the current cursor to the end of the displacement

"Content, such as Dw,delete word

C "similar to the D command function, different after the execution of the Delete command in insert mode, change

DD "Deletes an entire line

yy "Copy a whole line

P "Paste Clipboard contents to current position

Vimdiff 1.c 2.c "Create a vertical split window compare these two files to different places

Search command

F<a> "single character search, FA is searching the current line for the next a,find a

/string "Full text search for a string, if you want to find the word" func "with/func

"If the text has multiple func, pressing N will move to the next func position.

"N can also accept a number of digits, such as 3n, will be found immediately after the third Func

? string "is the same function as/string, the only difference is that the search is in the opposite direction

Note:

You can use: Set Noingorecase to ignore the case of characters;

and Commands have a memory function, you can use multiple <UP> keys to select the search history, record the maximum number of history of the order can be changed on the session viminfo;

Search characters. */?%$^[] and other special characters to precede with a backslash to turn;

Search to isolate words, that is, there are no other characters before and after (in addition to spaces, tabs), such as only search the, do not want to search there or whether such, to use/\<the\>;

can use: Set Hlsearch to search the words highlighted;

Positioning command

G "The cursor moves to the last line of the file, or shift+g

15G "The cursor moves to the 15th line of the file, or 15gg

GG "Cursor moved to the first line of the file

45% "Cursor moved to file 45%

H "Cursor moved to the beginning of the current screen

M Cursor moved to the middle of the current screen

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/

L the cursor moves to the end of the current screen

Note: Ctrl+g view current cursor position

Scrolling command

Ctrl+u window roll up half screen

Ctrl+d window rolls down half screen

Ctrl+e "roll up one line, not much practical

Ctrl+y "roll down one line

Ctrl+f "roll forward a whole screen

Ctrl+b "Roll back one whole screen

ZZ "The current line is placed in the center of the screen

ZT "Current line at top of screen

ZB the current line at the bottom of the screen

Split window

: Split "split Sideways"

: New "To add a window horizontally

: Vsplit "Vertical split

: Vnew "Add a new window vertically"

Crtl+w W "switch small windows in order

: Qall "Close all windows

: Wall "Save all windows

Label (TAB) command

: Tabedit filename "To create a tab page named filename in the Vim window being edited

: Tab Split "Create a new tab page

GT move to the next tab page

GT move to the next tab page

Rectangular selection block (multiline comment)

#多行注释

Position the cursor to the first non-whitespace character in a line

Press CTRL + V to select the start position;

Ctrl+d or up and down arrows to move;

Press I, enter "//", then press ESC to complete a multiline comment;

Note The third step above you can also use the left and right arrows for rectangular area selection

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.