Hacker Newsnew | comments | show | ask | jobs | submit login

Slightly tangential, but the author mentions remapping Caps_Lock, as I do (I've mapped it to Escape, as Esc used to be where Tab is on modern keyboards anyway). The moment I first did this, I realized how amazing vim really is, and why people always say that you can navigate the entire file without moving your hands from the home row.

However, both methods I know for doing this only work inside an X server - does anybody know a good way to remap keys without X?




I used to have it mapped to escape but once I started using tmux I mapped caps lock to control and never looked back. Much more versatile than escape and ctrl+[ will do the same thing (although it's proving hard to break the habit of pressing escape instead).

-----


Best of both worlds: KeyRemap4MacBook has a setting where Control acts as Control when held down, but acts as Escape if typed alone. This in combination with setting Caps Lock as Control in OSX is all sorts of awesome.

-----


Unmap your escape key, that will force the habit. I did this when I moved my control and meta keys to the left thumb of my kinesis keyboard, and it helped train me not to hit the old keys.

-----


I've tried this in the past but it made both escape and ctrl+[ no longer function. What worked for you?

-----


Under OSX I used a tool called KeyRemap4MacBook which adds an item to the control panel that lets you reconfigure keys. I just tested it, you can can disable the escape key, but Ctrl-[ still works like you'd expect.

-----


imap jk <Esc>

Hitting jk in insert mode for escape is wonderful.

-----


I had to create a modified keyboard layout, starting from one in /usr/share/kbd/keymaps.

Use the showkey command to find out what keycode the caps lock key generates (mine is 58), then add a line in your layout file to the effect of

keycode 58 = Escape Escape Escape Escape Escape

Finally, load your new layout using loadkeys /usr/share/kbd/keymaps/i386/{yourlayoutname}/{yourlayoutname}.map.gz

-----


I finally tried this out today: (while TERM=linux) keys.kmap: keymaps 0-127 keycode 1 = CtrlL_Lock keycode 58 = Control

sudo loadkeys keys.kmap

This works, but I haven't set this up to load on startup yet.

-----


I think you have to play with loadkeys and a custom mapping.

-----


In linux you want to use loadkeys(1).

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: