Down with Caps Lock!

The Caps Lock key does me no good at all, but I use Esc constantly as a vim user. So, I set about making the Caps Lock key a second Esc.

On Linux, I used the xmodmap command (because I spend all my time in X – the console is not necessary) in my .xinitrc file like so:

xmodmap -e "remove lock = Caps_Lock"
xmodmap -e "keycode 66 = Escape"

Because I am shackled to a Windows box day after day, I also wanted to make this work in that environment, and luckily, I can. It just took a brave bit of registry editing, like so:

REGEDIT4
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlKeyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,01,00,3a,00,00,00,00,00

It makes a huge difference to not have to reach for the Esc key all the time, but it makes it so easy that I keep shifting into command mode while typing in Word. A small price, especially since I realize I’m happiest writing in vim anyway.

Seven Habits of Effective Text Editing

Like so many of the tips and tricks and hither-to unknown commands that I find in vim, I wish I have known about this years ago. There are a ton of little tricks in this short piece that are hugely useful.

One trick that I think is just the bee’s knees is *. If you are on a word in command mode, hit * and you will search for that word. Even better though, is the gd trick. When the cursor is on a variable name, typing gd will take you to the declaration of that variable.

The last thing that I think is awesome is "repeat the last change". If I am doing something repetitive, like creating an associative array of static values, I can type the first declaration and then start hitting . in command mode until I have enough declarations for the whole array. Very sweet.

httrack

I’ve been looking for an enhancement for wget for a while now, and I think I’ve finally found it. httrack seems to do a nice job of pulling down a site to a local repository so that it can be viewed as expected off the filesystem. Additionally, it purportedly (testing is ongoing) also does updates, which should help as well. The main problem with wget was that stylesheets called using the @import convention were not downloaded, and image references within stylesheets were also not fetched, which leads to unstyled pages in local repositories, which I didn’t like. There’s more testing to do, but so far the system looks good.