Vim tips (map the Caps Lock key to ESC)

Source: Internet
Author: User

Caps LockFor us, it is basically redundant, and the position on the keyboard is unreasonable. When we accidentally pressCaps LockAnd then an error occurs.ESCThe most frequently used button in vim.Caps LockReplaceESCIt's really good, and you don't have to worry about pressing<ESC>When the press to the damn<F1>.

Someone may ask, isn't it inconvenient for consecutive capital statements? We can use lower-case letters first, select the text in the section, and press u to convert it to upper-case letters. Do you thinkCaps LockIs it redundant?


Replacement method:

xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'


According to the author's test, after the computer restarts,Caps LockAgain, this is not what we expected, but it is also good to think about it carefully. If we use other people's computers, it is always hard to put others'sCaps LockChangeESCBut it is always possible to change it for the moment. In this case, the above statement is not suitable. But there is still a problem that needs to be solved. We cannot manually execute this statement every time we enable it on our computer. The answer is also clear, let Linux Execute this statement every time it is started.
Add the preceding statement to the end of. profile. On your own computerCaps LockChangeESCIt does not matter, the specific method please refer to: http://c2.com/cgi/wiki? Remapcapslock

Here is another tips for uppercase in VIM:

"change word to uppercase, I love this very muchinoremap <C-u> <esc>gUiwea

The preceding statement is stored in the. vimrc file, and its function is to pressCTRL + uIn upper case.

References:

Http://stackoverflow.com/questions/2176532/how-to-map-caps-lock-key-in-vim

Https://bitbucket.org/sjl/dotfiles/src/tip/vim/.vimrc

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.