4 ms·
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).
by chimeracoder 14y ago
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?
- spudlyo 14y agoIn linux you want to use loadkeys(1).
- johncoltrane 14y agoI think you have to play with loadkeys and a custom mapping.
- s00pcan 14y agoI 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).
- spudlyo 14y agoUnmap 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.
- s00pcan 14y agoI've tried this in the past but it made both escape and ctrl+[ no longer function. What worked for you?
- spudlyo 14y agoUnder 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.
- joe42 14y agoimap jk <Esc> Hitting jk in insert mode for escape is wonderful.
- miketwo 14y agoBest 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.
- dickfickling 14y agoI 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
- s00pcan 14y agoI 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.