程序员的VIM设置,用于芬兰/瑞典或其他非美国键盘布局 [英] Programmer's VIM setup for Finnish/Swedish or other non-US keyboard layout

查看:160
本文介绍了程序员的VIM设置,用于芬兰/瑞典或其他非美国键盘布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在学习一些VIM黑客,并且学到了许多有用的命令,并且在使用VIM编辑文本方面非常有效.我使用的是芬兰qwerty键盘布局(请参见下图),这对于编程来说非常可怕.您所有常用的编码特殊字符()[]{}/\都可以通过按 shift alt gr number 键来实现,但是我已经很习惯了对此.我不想更改键盘布局,因为我用母语进行了大量的编写和IRC聊天,因此我需要äö字符(å对我来说是无用的,只有瑞典人使用那个).

I've been recently learning some VIM hackery and I have learned a lot of useful commands and gotten pretty efficient at editing text with VIM. I'm using the Finnish qwerty keyboard layout (see image below) which is pretty horrible for programming. All your usual coding special characters ()[]{}/\ happen by pressing either shift or alt gr and a number key, but I'm already pretty used to that. I do not want to change my keyboard layout since I do quite a lot of writing and IRC chatting in my native language and for that I need the ä and ö characters (the å is useless for me, only the Swedes use that).

我的问题是,默认情况下,某些VIM命令的键映射非常困难,例如go-to-tag-under-cursor是^],它转换为 Ctrl - AltGr - 9 .这需要我用左手按下左控制键,用右手拇指按下 alt gr ,并将右手食指延伸到数字9 键.感觉就像使用emacs和/或弹古典吉他一样.不完全符合人体工程学.

My problem is that some VIM commands have a pretty difficult keymapping by default, for example go-to-tag-under-cursor is ^] which translates to Ctrl-AltGr-9 on a Finnish keyboard. This requires me to press the left control key with my left hand, alt gr with my right thumb and extending my right index finger to the number 9 key. This feels like using emacs and/or playing classical guitar. Not exactly ergonomic.

这是键盘布局的样子:

注意:标记为蓝色的键是通过按 AltGr (右alt)和相应的键来编写的.红色的是两键组成的字符或死键,它们自己不会给出字符. F.ex.要键入ü字符,请先按¨^〜键,然后按 u .重音键也一样.这些死键在VIM中不可映射.

NOTE: the keys that are marked blue are written by pressing AltGr (right alt) and the appropriate key. The red ones are two-key compose characters or dead keys which do not give out a character by them selves. F.ex. to type the ü character you first press the ¨^~ key and then u. Same goes for the accent keys. These dead keys are unmappable in VIM.

所以基本上我有3个额外的字母键(ä ö å),但是它们不能被多次映射,修饰键不要与他们一起使用(在VIM中).我可以将某些内容映射到ä,但不能映射到Ä<C-ä>.

So basically I have 3 extra alphabetical keys (äöå) available, but they cannot be mapped more than once, modifier keys do not work with them (in VIM). I can map something to ä, but not Ä or <C-ä>.

现在,我正在寻找来自芬兰/瑞典语或其他非美国键盘布局用户的VIM设置想法.请分享您的键映射,.vimrc技巧以及其他可能有用的信息.

Now I'm looking for ideas for my VIM setup from fellow Finnish/Swedish or other non-US keyboard layout users. Please share your key mappings, .vimrc tips and anything else that might be useful.

推荐答案

在编码时,我只是保持键盘使用美式布局,而在编写需要重音字母或其他特定于语言的字符的文本时,只切换到本地布局(意大利语).毕竟,这只是切换的按键,而且没有什么比美国编程布局更好的了.我尝试了一下,但发现指定许多映射来解决此问题比需要完全布局切换要麻烦得多.

I just keep the keyboard with US layout when coding and only switch to local layout (italian) when writing text that requires accented letters or other language specific characters. After all it's just a keypress to switch and nothing beats US layout for programming. I tried a bit but found that specifying lots of mappings to work around this is far more troublesome than a full layout switch on need.

这篇关于程序员的VIM设置,用于芬兰/瑞典或其他非美国键盘布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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