I’m starting to get things together at work now.
I’ve got a computer to call my own and I’ve taken in my keyboard, a new mouse, and my headphones. I’ve started to set up my environment so my keyboard shortcuts work. I’ve switched the Caps Lock and Escape keys so I can use vim comfortably again. It messes everything up for other people who try to use my computer though.
I am looking forward to getting to work tomorrow and getting some proper code written. I haven’t written any for a while and I’m starting to wonder if I’ll be able to remember how to do it.
There’s a barbecue at work tomorrow afternoon after an all-hands meeting. It’ll be quite nice to see people ever-so-slightly out of the work environment, even if it is just in the car park. 🙂
I’ve started reading on the tube so it’s making the journey seem faster, and helping me get through my massive reading list. I’m looking forward to making some serious progress over the next few months. For now I’ll just be quite pleased to finish A Room With a View and then maybe renew my efforts of defeating Ulysses.
So yeah, basically things are going well. 😀
I was altering some code in Vim a little while ago. I had recently undone some warnings because I thought I didn’t need them any more. It turned out that I did. I started typing :redo :redo :redo and the changes were coming back gradually, but it was a pain to type the command each time.
In Vim the ‘.’ key repeats the last action, so I figured it would save me a lot of time to just press that instead. Bad idea! The ‘.’ character will not repeat the :redo command, it will repeat the action that the :redo caused. So if :redo inserted some text then pressing ‘.’ will cause that same section of text to be inserted again.
This is not only a bit annoying, but also causes a divergence from the history meaning you can no longer use :redo to get back to where you were going. 🙁
A useful shortcut for redo in Vim is Ctrl-r. I’m slowly becoming less of a Vim n00b.
Now I better get back to typing in all of my warns.
When was the last time you used the Escape key on your keyboard? For a lot of you it quite probably was a fairly long time ago.
When was the last time you used the Caps Lock key? For all of you it should have been a long time ago!
I do my programming in Vim and to switch between Insert and Visual mode I have to press the Escape key. This wasn’t so much of a problem when I didn’t do so much coding, but now it’s my full-time job I find it to be quite a pain, literally. After a full week of programming in Vim my poor little finger is hurting from extending up to the Escape key.
Today I decided to solve this problem once and for all.
I mentioned the Caps Lock key earlier on. It’s on the “Home Row” of the keyboard. This means that it’s right beside where you should position your fingers when using a keyboard. Your left hand should sit on ASDF from little finger to index finger, and your right hand should sit on JKL; from index finger to little finger. You’ll notice that (on most keyboards) there is a little notch on the F and J keys. These are there to help you find the proper hand position without having to look at the keyboard. Of course, this all assumes you’re using the QWERTY keyboard layout and not Dvorak, or something entirely different.
Proper finger position
In Linux there is a utility to change various keyboard and mouse settings called xmodmap. This gives you the ability to remap keys to different functionalities.
I’ve used xmodmap to switch my Escape key fucntionality to the Caps Lock key and vice versa. This is going to take some getting used to, but the overall benefit to my fingers should be quite significant. It’ll also have the unintended side-effect of stopping me accidentally going into cPS MODE WHEN I MISS THE ‘A’ KEY. 😉 Of course, there will be some programs where pressing escape will cause the window to close, or the action to be cancelled. I guess I’ll just have to be more careful than I was before to avoid accidentally hitting the key to the left of ‘A’.
The way I set this up was using a file called .Xmodmap in my home directory. The contents of this file are loaded by xmodmap every time you log into the computer. The file contains the following:
! Swap Caps_Lock and Escape
remove Lock = Caps_Lock
remove Control = Escape
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock
add Control = Escape
Now to get back to writing code and start saving my left little finger.