How to define shortcuts in VIM

Source: Internet
Author: User

Previous blog 《Copy content in VIM to system clipboardThis section describes how to copy the content in VIM to the system clipboard. It can be seen that a copy requires many keys, so I want to define a shortcut key to simplify the operation. The process is very simple. For example, if I want to set the shortcut key for copying the full text to Ca (meaning copy all), the process is as follows:

1. test whether the CA is in use. Enter CA in normal mode to check whether there is any response. If not, the Ca is not in use.

2 edit ~ /. Vimrc file, add

Map ca {ggvg "+ y}

3. Open a file and press CA in normal mode. The message "Copied ** line" is displayed.

In the insert mode, if you want to switch to normal mode, press the ESC key. Because the distance is too long and the operation is inconvenient, a keyboard ing is usually performed.

Edit ~ /. Vimrc file, add

Imap jj <ESC>

In this way, in the insert mode, it is too convenient to press JJ twice consecutively, not only does not input two j s, but also switches to the normal mode!

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.