tail -f findings.out

Maps Caps Lock key to Escape

One thing that bothered me about vim for some time was the delay in getting access to command mode. Reaching up and over to Escape just felt unnatural. So why not bind this action to a closer key?

A good candidate is the Caps Lock key. I almost never need to use the Caps Lock key in normal use. Who wants to write in all caps? However, this key is much closer to the home row relative to the Escape key. It turns out there isn’t a way to do this in vim. Key bindings bind a command to a key not normally associated with that command. Binding a key to another key, regardless of what command that key maps to, is outside of vim’s purview.

To solve this, we need to change the mapping of the keycodes at a lower level. The following script will allow you to toggle this mapping on and off. Once toggled, it lasts across restarts. So you only need to toggle it again if you need to use Caps Lock for its original purpose. Its use is explained in the comments:

Continue Reading “Maps Caps Lock key to Escape”

Tags: , , ,
January 31, 2009 - 8:15 PM Comment (1)

Awesome new keyboard shortcuts

A few new bash shortcuts I have recently come across that fill me with joy:

  • “Alt + .”: This inserts the last argument to the last command. So say you just tailed a config file and you want to vim it. You can do tail
    1
    thing.conf

    then

    1
    vim

    , “alt + .” and you will get:

    1
    vim thing.conf

    . Can be very helpful once you get used to it being there!

  • “ctrl + r, ctrl + r”: When you do “ctrl + r” and start typing, your bash history is searched for whatever you are typing. But what if there are multiple matches, and you don’t want the first one? Press “ctrl + r” again! This is basically a “find next”. This way you can view the matches and run the one you want.
Tags: , , , ,
November 8, 2008 - 1:11 AM No Comments

Twitter links powered by Tweet This v1.6.1, a WordPress plugin for Twitter.