Gentlemen, set your keyboards to 'optimized'

Yanick on 2006-09-13T17:15:15

Yesterday, I decided to put in action two of the neato keyboard layout optimization tricks that I got from the the vim tips rss feed.

optimization 1: ( $caps_lock, $esc ) = ( $esc, $caps_lock )

In vim, one hits ESC a gazillion time a day and CAPS LOCK maybe, on two or three times a century. Yet, the first key is located at the outside periphery of the keyboard while the second sits, fat and proud, in the middle of things. Not fair. Well, doing a xmodmap escapswapper fix that engineering blunder, where escapswapper is:

! Swap caps lock and escape
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock

optimization 2: y/123456789/!@#$%^&*()/

When one programs in Perl, one gets to type '$', '@' and '%' six times per line (or more, if you're a Perl golfer or swear a lot in your comments). In comparison, numbers are used a wee bit less frequently. And yet, it's the symbols that get the shift tax. Not fair. Again, a little remapping easily corrects this gross injustice:

in ~/.vimrc

autocmd FileType perl source ~/.vim/my/perl_map.vim

and in ~/.vim/my/perl_map.vim

" map each number to its shift-key character
inoremap 1 !
inoremap 2 @
inoremap 3 #
inoremap 4 $
inoremap 5 %
inoremap 6 ^
inoremap 7 &
inoremap 8 *
inoremap 9 (
inoremap 0 )
" and then the opposite
inoremap ! 1
inoremap @ 2
inoremap # 3
inoremap $ 4
inoremap % 5
inoremap ^ 6
inoremap & 7
inoremap * 8
inoremap ( 9
inoremap ) 0


Another swap.

Abigail on 2006-09-13T21:39:27

In vi I use the ':' function all the time. I seldomly use ';'. More than 20 years ago, I started mapping ';' to ':' in vi, and when I started to use a better programmable vi-clone, I simply reversed the meaning of ':' and ';'.

From my .vilerc file:

bind-key execute-named-command ;
bind-key repeat-char-scan :

Re:Another swap.

Yanick on 2006-09-14T19:02:20

Good one, I'm trying to add it to my config.

As I was expecting, the fingers will need a little bit of time to get used to the new layout of the keyboard. After five hours of coding, I had to momentarily change back to a plain vanilla setting to prevent my brain of bursting.

Funnily enough, though, not five minutes later I remapped ESC to CAPS LOCK, 'cause as slightly confusing its new position is, it's leagues better than its far-away original location. :-)

Re:Another swap.

Yanick on 2006-09-14T19:04:09

Gaah. Wrong formatting!

Good one, I'm trying to add it to my config.

As I was expecting, the fingers will need a little bit of time to get used to the new layout of the keyboard. After five hours of coding, I had to momentarily change back to a plain vanilla setting to prevent my brain of bursting.

Funnily enough, though, not five minutes later I remapped ESC to CAPS LOCK, 'cause as slightly confusing its new position is, it's leagues better than its far-away original location. :-)