开发者

Map a caps lock key that is mapped to ctrl system wide to Escape just in vim

i have mapped my caps lock key to ctrl with the following command under linux:

setxkbmap -option ctrl:nocaps I really like this mapping and want to keep it, but I also would like to map the caps lock key to Escape when I am inside vim. But when I try to map it with :map <C> <Esc> or similar it does not seem to work, presumably because the ctrl key is special and needs a second key to to trigg开发者_如何转开发er an key event.

Is there any way I can achieve the above?


Dave is right, you can't. However, there are lots of alternatives to remap the escape key. I personaly use ` which is close (on my keyboard) to the capslock key :-) (as ' is pretty useless , you can remap ' to `)

noremap ' `
noremap ` <Esc>


No. The control, shift and alt keys are handled differently at the hardware and OS levels - they do not generate keycodes but add modifiers to the keycodes generated by other keys. This means that they cannot be mapped within Vim.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜