Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Yanick (3196)

Yanick
  (email not shown publicly)
http://babyl.dyndns.org/techblog

Journal of Yanick (3196)

Wednesday September 13, 2006
12:15 PM

Gentlemen, set your keyboards to 'optimized'

[ #30983 ]

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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • 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 :
    • 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. :-)
      • 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. :-)