Vim introduction Vim color display and move cursor VIM general mode move cursor General mode copy cut paste

Source: Internet
Author: User

Introduction to Vim
Vim is a well-known, powerful, highly customizable text editor similar to VI, which improves and adds many features on the basis of VI.

First install Vim
Yum Install-y vim-enhanced

·
Let's compare the difference between the VI and VIM open
Let's open the/etc/passwd/with VI and look at it.

·
Take a look at the vim/etc/passwd/again.

·
We can see VI open/etc/passwd/is no color, and with vim open, is color, this is the biggest difference between the VI and VIM
·
Do not modify the contents of the/etc/passwd/inside, this is the system files, after reading: Q Do not save the exit can
·
Vim is divided into 3 modes, general, edit, default mode of the 3 modes
General mode: We can do things like DD delete a whole line of content
Edit mode: After we enter the configuration file, press the corresponding button, you can modify the document, such as I
Command mode: The most common is Wq, Q,!q,!wq This is the common command pattern
·
·
·
·
·
Vim color display and move cursor
We already know, the vim configuration file, there will be color display, but the same configuration file in different directories will not display color
For example: We move the/etc/passwd/to the/tmp/, and then vim he will not show the color

·
Whether the vim color shows many aspects, such as the directory, suffix, etc.
·
VIM has its own configuration file, in/ETC/VIMRC
Users can configure their own vim:

·
Move cursor: H left, l or space right, J, K
We can also use the number plus the key to move the cursor, meaning to move a few letters in this direction.
·
·
·
·
·

Vim General mode to move the cursor
Ctrl+f is a screen one screen of the downward turn, ctrl+b is a screen one screen of the upside-down
0 or shift+6 can be moved quickly to the beginning of the line, Shift+4 can be quickly moved to the end
GG moves to the beginning of the first
Shift+g move to the last line
The number plus shift+g can be moved to the beginning of the specified line

·
·
·
·
·
Copy cut paste in general mode
x remove one character backward, shift+x one character forward
Number +x backward (cut) How many characters, number +x forward delete (cut) how many characters
DD Delete (cut) cursor in the row
Number +DD Delete (cut) includes the number of rows down the line where the cursor is located
YY the copy cursor is in the row
Digital +YY replication includes how many lines down the line the cursor is in
P Paste to the next line in the row where the current cursor is located
P Paste to the previous row of the current cursor
U undo one-step operation up to 50 undo
Ctrl+i Undo One-step operation, (can be revoked when the revocation of the back)
V Custom Cut, press V, then move the cursor select the character you want to cut and press X to cut it.
·

Vim introduction Vim color display and move cursor VIM general mode move cursor General mode copy cut paste

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.