Vim Base Command __vim

Source: Internet
Author: User
Tags save file
Command mode
Tapping Keys meaning
: Wq Save exit
: q! Exit
Insert mode inserts in various ways
Tapping Keys meaning
I Enter insert mode at the front of the cursor
I Enter insert mode at the beginning of the line where the cursor is located
A Enter insert mode behind the cursor
A Enter insert mode at the end of the line where the cursor is located
O Insert a space below the line where the cursor is located and enter insert mode
O Insert a space above the line where the cursor is located and enter insert mode
S Deletes the character specified by the cursor and enters insert mode
S Clears the cursor line and enters insert mode
Normal Mode
Tapping Keys meaning
X Remove single character
0 Position the cursor at the beginning of the line
^ Ditto
$ Position the cursor at the end of the line
B Position the cursor at the beginning of the word
E Set the cursor at the end of the word
W Position the cursor at the beginning of the next word
Gg Position the cursor at the beginning of the file
G Position the cursor at the end of the file
more Delete Commands
Tapping Keys meaning
D0 Deletes all characters from the current position (not included) to the beginning of the line
d$ Deletes all characters from the current position (including) to the end of a row
Db Remove all characters from the current position of the cursor (not included) at the beginning of the word
De Remove all characters from the end of the original location word
Dw Deletes all characters from the current position (contained) to the beginning of the next position
Dh Deletes one character at the front of the cursor
Dl Deletes the character specified by the cursor
Dj Delete all characters on the line where the cursor is located and the next line
Dk Delete the line that contains the cursor and all the characters on the previous line
Dd Remove all characters from the line where the cursor is located
DGG Deletes all characters that sit at the beginning of a row to a file
Dg Deletes all characters at the end of the line file where the cursor is located
Regret Medicine
Tapping Keys meaning
U Indicates that the last modification was undone
U Indicates undo modification of the entire row
Ctrl+r Shortcut keys to fix the undo content

Using the Delete command in VIM does not erase your items directly but put them in a vim register. Paste Command

Use the ' P ' command to paste the last deleted content after the cursor, ' P ' to paste before the cursor replace the command

Tapping Keys meaning
R Enter replace mode (replace in lower left corner) at this time the input character replaces the current character
R Replaces the character of the current cursor (without entering insert mode)
3r Replace the character (included) and the following two characters (not to be changed if not enough)
: s/old/new Replaces the first old of the row on which the cursor resides with the new
: s/old/new/g Replaces all the old of the line that contains the cursor with new
: 5,13s/old/new/g Replace all old from line fifth to 13th
:%s/old/new/g Replace the full old text with new
:%S/OLD/NEW/GC Full-text substitution but asks before each replacement

-Y indicates replacement
-N Do not replace
-A replaces all
-Q Discard Replacement
-L REPLACE the first one and go into insert
-^e with ctrl+e scrolling screen
-^y with ctrl+y scrolling screen modify command

C[number] Motion
    number indicates repeated motion range
c$ " ce on the next line of the cursor " "
meaning
c0 deletes all characters from the current position (not included) to the current beginning of the line, and goes to insert
c^ previous
Deletes the character at the end of the line at the current position (included). Enter the Insert
CB Delete the current location (not included) to the beginning of the word, enter the Insert "
Deletes the current position (included) to the end of the word, enters the character at the beginning of the insert
cw , and enters the insert< at the start of the next word. /td>
c2w Delete the character from the current position to the beginning of the next word enter Insert
ch Delete The cursor precedes a character and enters the insert
cl Delete the specified character into insert
CJ deletes all the characters on the line with the cursor and on the next line, and inserts one line under the cursor
ck Deletes the line that contains the cursor and the character on the previous line, and enters the insert
cc Deletes the character of the line on which the cursor is located, entering insert
Copy Command
Tapping Keys meaning
Yy Copy when moving forward
3yy Copy 3 lines
y$ The character at the end of the line where the copy cursor is
YG The character of the line at the end of the file where the copy cursor is
Search Command
/target . Target
Search direction Start backwards from the cursor Start with the cursor forward
N Search backwards for Next Search forward Next
N Search forward Next Want to search the next

Note:., *,[,],^,%,/,?, ~ These 10 characters need to be preceded by a backslash (\) file basic Operation

Ctrl+g display is the basic information of the file (file name, whether modified, Total row number, cursor location)

Switch to the specified location:

Line number +g: line number

Positioning brackets:

{} [] ()

Move the cursor to any half of the brackets and press the% key, and the cursor will automatically jump to the other half.

See what directories are currently/below my files

:!ls
Save File as
: W Test
Local Save As
Press V into visual mode (visual) and then the cursor goes to the selected state.
: ';, ' > W Test
Merging files to read and place the established file contents into the next line of the cursor
: R Test
Open multiple files (vertical arrangement), use ctrl+w+ up and down to toggle up and down
Vim-o Test Test1 Test2
Open multiple files (horizontal arrangement) use ctrl+w+ to toggle around
Vim-o Test Test1 Test2
Exit file

: q– exit
: q! -Force exit
: wq– Save Exit
ZZ (Shirt+z+z)
-Multiple Windows one exit
After the original command, add
A

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.