将键重新映射到Vim中的Escape(德语键盘) [英] Remapping a key to Escape in Vim (German keyboard)

查看:292
本文介绍了将键重新映射到Vim中的Escape(德语键盘)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,所以我一直在尝试Vim(标准控制台版本;我的操作系统是Linux Mint 13),我想摆脱不得不使用Escape键更改模式。优选地,我想交换Capslock和Escape键,但就我所听说的,这是不可能在Vim本身。我发现的大多数解决方案涉及在全局级别(使用 xmodmap 或任何)更改键,但我不是真的想要。如果有一个简单的方法,只有在Vim 中交换Capslock和退出,请让我知道。

Okay, so I've been trying out Vim (the standard console version; my OS is Linux Mint 13) and I'd like to get rid of having to use the Escape key to change modes. Preferably, I'd like to swap the Capslock and Escape keys, but as far as I've heard, that's not possible within Vim itself. Most "solutions" I've found involve changing the key on a global level (using xmodmap or whatever), but I don't really want that. If there's an easy way to swap Capslock and Escape only in Vim, please let me know.

我听说过的另一件常见事情是使用Ctrl- [作为Escape的等价物。但是,因为我使用不同布局的德语键盘,这不是一个选项。所以,我想我会使用 noremap< C-ü>在Vim中的< Esc> (德语键盘上的ü键与美国键盘上的[键)位于同一位置,但是没有效果。我假设这是因为ü不是一个ASCII字符。有任何方法可以让这两个选项中的任何一个工作吗?

Another common thing I've heard of is using "Ctrl-[" as an equivalent to Escape. However, because I'm using a German keyboard with a different layout, that's not an option. So, I thought I'd use noremap <C-ü> <Esc> in Vim (the "ü" key on a German keyboard is in the same place as the "[" key on US keyboards), but that didn't work, either. I'm assuming that's because "ü" isn't an ASCII character. Is there any way to get either of these options working?

UPDATE :这很奇怪。经过更多的实验,似乎Ctrl-ü毕竟工作。我不知道发生了什么 - 也许我搞砸了一些编码相关的设置,而尝试不同的事情?如果没有重新映射大写锁定的好解决方案,我想我会坚持使用Ctrl-ü。

UPDATE: Well, this is strange. After experimenting some more, it seems that "Ctrl-ü" does work after all. I'm not sure what happened – maybe I messed up some encoding-related settings while trying different things? If there is no good solution for remapping capslock, I guess I will stick with "Ctrl-ü".

推荐答案

,最后我决定用< C-ü> 去,因为它不与任何其他冲突,因为它与< C -

So, yeah, eventually I decided to go with <C-ü> because it doesn't conflict with anything else and because it's the same as <C-[> on US keyboards.

然而,因为我厌倦了使用德语键盘布局进行编程(例如,得到{你需要输入Alt Gr-7),我把我的键盘切换到美国国际,其本质上有类似的效果,就Vim而言。它也有助于如果你想要进入触摸式的习惯;你实际上不能看键盘,因为键没有标记为正确; - )

However, because I'm getting tired of using the German keyboard layout for programming (for example, to get "{" you need to type "Alt Gr-7"), I'm switching my keyboard to US-International, which essentially has a similar effect as far as Vim is concerned. It also helps if you want to want to get into the habit of touch-typing; you actually can't look at the keyboard because the keys aren't labeled "correctly" ;-)

这篇关于将键重新映射到Vim中的Escape(德语键盘)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆