Basic commands in vimtutor

Source: Internet
Author: User

After reading some basic commands in the vimtutuor tutorial today, I wrote something that might be important... After all, I have not written it in vim.ProgramAnd...

In vim, the mouse is like a fish without water. It is not suitable at all. Every time I habitually click to delete the desired place. You can imagine ....

1. Delete and insert commands
: DW: de: d $; dd ....
There are also a lot of commands similar to delete. The differences between these commands are not very big. It should be better to distinguish them in time. The method of memory is not very good.
There are many extensions such as 2 DD, and so on. You will know more about them if you are confused ....

O insert a whole line above the cursor
O insert a whole line at the bottom of the cursor
$ Insert the cursor to the end of the row
Insert text at the end of a cursor
Insert text at the end of the row where the cursor is located
P copies the last deleted content at the cursor.
X Delete
I switch to insert mode
Switch ESC to normal mode (= Ctrl + C)
U undo the previous operation

U returns the original mode of the cursor row

YY copy the current row

Nyy copies n rows below the row at the cursor

In fact, many of the above insertion modes are almost identical, and functions can be used with each other. They are nothing more than tedious and simple, so I have not listed many of them. I am not very clear about them now, it's all nonsense. I can't try another one. Just be familiar with it... Haha.

2. Change the replacement command
: R can only change one letter
: CW is change word, which is easy to understand.
: C $ change from the cursor to the end of the row
S/a/B Replace the first a in the row with B
S/a/B/g replace a of the entire row with B
% S/a/B/g replace file a with B
#,# S/a/B/g replace #, # Replace a between two row numbers with B

3. SEARCH Command
/The string or text starts from the cursor to find the matching string (if it finds the end, it will start from scratch)
? The character string or text is just the opposite of the above
N: Find
Shift + N reverse lookup of the last Lookup
% Matching of parentheses. This write program is very useful.

4. File-related
:! Ls to list contents in the current directory
:! Dir: List contents in the current directory
CTRL + G display the position where the cursor is in the file
Row number + Shift + G jump to this row
#,# W test copy the content between the two lines to the file test
R test copies the content of test to the cursor

:! RM file name Delete this file

5. move the cursor

H: move the cursor to the first column of the first row of the current screen.

M: move the cursor to the first column of the middle row of the current screen

L; move the cursor to the first column of the last row of the current screen

G: Move to the beginning of the last row

NG: the nth row to be moved.

N +: Move n rows down

N-: Move n rows up

For the time being, what will be useful in the future ,...

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.