Linux VIM Basic operation

Source: Internet
Author: User

One, the copy of the character

Yl Copy a child mother
y3l Copy 3 sub-mothers
yw Copy a Word
y3w Copy 3 words
Yy Copy 1 rows
Y3y Copy 3 rows
P After the copy is complete, press "P" to paste

Second, the deletion of characters

Dl Delete a child parent
d3l Delete 3 sub-mothers
Dw Delete a word
B31 Delete 3 words
Dd Delete a row
D3d Delete 3 rows

Three, the cut of the character

Cl Cut a child mother
c3l Cut 3 sub-mothers
cw Cut a word
c3w Cut 3 words
Cc Cut one line
c3c Cut 3 Rows

Note: After clipping, you will enter into insert mode and be sure to exit insert mode when performing sticky actions.

Iv. Visual mode of VIM

1, press "CTRL + V" in the command mode to enter the visual mode, in the visual mode can select the area of characters.

2. Batch add characters in Visual mode

Step 1:CTRL+V Select the column to which you want to add characters

Step 2: Press "I" into insert mode, write the characters to be added

Step 3: Press ESC

V. Bulk modification of characters

:%s/original character/post substitution character Replaces only the first occurrence of the previous character in each row
:%s/original character/replace character/g Replace all existing characters in the full text
:%s/^\ *//g Remove the space at the beginning of the line, \ means escape

Vi. Vim's split screen

Ctrl+w s
Top and bottom split screen
Ctrl+w V Left and right split screen
Ctrl+w C Close the screen where the cursor is located
Ctrl+w up or down Cursor moves to the specified screen
: Sp+file2 Edit both the current file and File2

Seven, VIM cursor movement

In command mode:

: Digital Move to the specified row
G Last line of File
Gg The first line of the file

Under the Insert command

I Insert Cursor Position
I

The beginning of the cursor

A Next position of the character where the cursor is located
A The end of the line at which the cursor
O Next line of cursor
O The top row of the cursor
S Remove the character insertion of the cursor
S Delete the row where the cursor is inserted

Eight, Vim's exit mode

: Q Use VIM to open a file without any action on the post character of the person can exit directly
: q! When using VIM to open a file and manipulate the characters, discard all operations to exit
: Wq Save exit
: wq! Force-Save exit, take effect for Superuser and file owner

IX. Handbook of Vim

Vimtutor VIM's Handbook
: Q Exit Vimtutor


This article is from the "13122323" blog, please be sure to keep this source http://13132323.blog.51cto.com/13122323/1949103

Linux VIM Basic operation

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.