Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmer's VIM setup for Finnish/Swedish or other non-US keyboard layout

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).

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.

Here's what the keyboard layout looks like:

sweden keyboard

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.

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-ä>.

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.

like image 342
exDM69 Avatar asked Dec 08 '10 21:12

exDM69


1 Answers

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.

like image 171
Matteo Riva Avatar answered Oct 04 '22 11:10

Matteo Riva