Vim shortcut key summary

Source: Internet
Author: User

First, paste a VI/Vim keyboard image found on the Internet. You don't need to remember this figure. You will learn it in the process of using it. At present, I am also exploring some of the shortcut keys that I often use.

1. when I look at code pages, I like to use Ctrl + d (down half page) and CTRL + U (up half page). If you want to quickly reach the end of the entire file, you can press SHIFT + G to quickly start the entire file and press g twice in a row. If you want to jump to the specified number of rows, such as 10th, you can jump to the cluster by 10 Gbit/s or 10 Gbit/s.

2. I like to use I (insert at the current position of the cursor), O (insert in the next line, it will automatically align), A (insert in the next character of the cursor ), A (insert at the end of the row.

3. frequently Used Delete, cut, copy, and paste operations. When deleting a single character, the most commonly used operation is Press X. When you need to delete a word, you can use DW to cut it out, to delete a whole row, press d twice. to delete all the content after the cursor, use Shift + D to delete it. To delete multiple rows, add a number and a DD, for example, to delete 10 rows, you can cut them by 10dd. If you do not know a few rows, use Shift + V and press J/K to select the content to be deleted and press DD. When it comes to "D", "Y" means "copy". Its usage is similar to "D". The difference is the difference between "cut" and "copy. Whether it is cut or copied, you can use P to paste it. In Linux, you can use Shift + insert to paste data. If you cannot delete backspace, you can use Shift + Delete to delete data.

4. move the cursor. W can be used to jump to the next word, B can be used to roll back to the previous word, and shift + 4 ($) can be used to move the cursor to the end of the line ), use 0 or SHIFT + 6 (^) at the beginning of the line. The difference between the two is that 0 is returned to the beginning of the line, whether or not this line starts with a blank character, shift + 6 (^) is the first non-blank character in the row. {Indicates the beginning of a field,} indicates the end of a field.

5. sometimes, when the Code alignment format is incorrect, do not press spaces or delete a line by line. Vim still provides block operations. The method used is to press Ctrl + V into the visual block mode, move the cursor to select the return result of the operation. At this time, if you want to add two spaces before each row selected

You only need to press Ctrl + V -- select the range -- Shift + I -- and press esc twice.

Similarly, when you want to delete a file, press Ctrl + V --> select range --> Press X --> Press ESC twice.

By the way, you can also use the VI operation method on the Linux terminal interface. You only need to enter the set-O vi

Then, you can use kJ to select historical commands by pressing ESC.

Almost the same as the operations in VI.

The memory is a little bad. I always feel that writing something is incomplete. I will record so many records first, and then I will make some supplements later ~~ For some shortcut keys, refer to the above VI/Vim keyboard diagram. All of the above are personal experiences. If you have any mistakes, please point them out ~ Thank you.

Vim shortcut key summary

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.