Summary of Vim shortcuts and summary of Vim shortcuts

Source: Internet
Author: User

Summary of Vim shortcuts and summary of Vim shortcuts

In July, I had to add more than one piece of water each month. Record the simplest shortcut key. (Add a little bit every day)

Alt + 4: move the cursor to the end of the row quickly;

Alt + 6: move the cursor to the beginning of the row quickly;

Command Line Mode: vsp and sp multi-frequency Screen opening.

Non-edit mode:> indent, <undo, n>, n <,

Delete: dd, n + dd

Copy: yy

Paste: p

Undo: u


What is the shortcut key for VIM copy and paste?

The answer from others is clear.

The most basic copy is y, the paste is p, and the cut is d.
The copy and cut commands can be followed by a move command to copy the text in the cursor movement range.

The difference between p and P during pasting is the difference before and after the cursor is pasted.

If you want to paste data in insert mode, you can press ctrl-r * to paste the data in normal mode.

What is the shortcut key for vim multi-line comment?

I use my own customization. Share it with you. Hope to help you.
Add the following statement to. vimrc:
Vmap <C-S-P> dO # endif <Esc> PO # if 0 <Esc>

In normal mode, press "V" (uppercase) to enter the <visual line> mode, press the top and bottom keys, select the row to be annotated, and press CTRL + SHIFT + P, in this way, # if 0 and # endif will be added up and down the selected row. It serves as a comment.

In the C language, it is not safe to use/**/to annotate multiple rows, so the "# if 0" method is used. If you need other methods, you can also refer to this idea.

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.