Skip to main content

On shortcuts

I made the Big Switch from Windows to Linux at work several years ago, and never really looked back. For whatever reason, our version control system and builds are always about twice as fast on Linux compared to Windows. I'm also much more comfortable in a UNIX-y shell / scripting environment than I am in Windows Command Prompt, probably because of hours spent in various computer labs at university when I really should have been doing something more fun (like drinking beer).

As well as the raw productivity gain from the faster environment, I also customized my environment a great deal to minimize keypresses. For example, where most other people in my team might type something like this:

cd $ADE_VIEW_ROOT/jdevadf/modules/ide/src/oracle/ide
ade co -nc Ide.java MainWindow.java
cd `pwd`
emacs Ide.java MainWindow.java
cd $ADE_VIEW_ROOT/jdevadf
make release
I type:
m ide/src/oracle/ide
co Ide.java MainWindow.java
emacs Ide.java MainWindow.java
jdevadf
mrel
Doesn't seem like much, but over many many months and years of coding, all those extra keystrokes add up... Better still, I had some immensely powerful tools in my box that would invoke compound commands to provide interesting information.

So, if I wanted to quickly find a file in our source control system (an operation that can be sped up by grepping some version control metadata files, chopping the file up to make it readable), I'd type wi SomeFile.java (where is?). If I wanted to know which module (out of about 600 in our system) was responsible for delivering a jar file (again which involved a lot of grepping through multiple files and cleaning up the output), I could ask wm foo.java (which module?).

These utilities ran ridiculously quickly, because I figured out tricks that were somewhat specific to our system. For example, grepping the version control files to locate a file is way faster than using "find", since it's a grep on a single file instead of a directory tree traversal. Their real power was in compound commands. I could check out all files with the extension xml that contained the string "brian.duff" with a command like this:

wi '\.xml$' | xargs grep -l 'brian\.duff' | xargs co
This is all fine and great, but there's a huge downside. Every time I sat at someone else's terminal to help them with some problem and attempted to run some commands, I had to remember to type the longwinded versions of all these commands again. Like being thrown back into the dark ages. Worse than that, it actually slowed me down even compared to someone without the shortcuts, since my fingers would frequently forget and type my shortcuts instinctively even though my higher brain was fully aware that they wouldn't work. Finger memory is a strange thing.

Comments

  1. hi there,

    "Finger Memory" : somehow, when someone asks for the emacs(xemacs) shortcuts, I can't seem to remember. The fingers need to be on a keyboard to remember :-)

    I do shortcuts like you do. But I haven't so far used the metadata find yet!

    Yes, sometimes when you're helping someone else on their boxes, it hurts.

    I use windows and occasionally linux, depending on where I'm working at. I use MC(midnight commander) to switch between projects/modules directories. If someone asks help from me, I demand that they let me use mc. Since mc doesn't take much time to setup, I can still be productive while helping them.

    BR,
    ~A

    ReplyDelete

Post a Comment

Popular posts from this blog

Java Blooper #2: Must be a Better Way...

The post you're reading is ancient, and yet slightly inexplicably popular :) I've recently started blogging again in 2020 with some fresh content. Check out some of the new topics about blogging again, dynamic method invocation, and aapt2.It's Monday, which means it's time for another blooper... What's wrong with this code? boolean hasThing( List things, Thing thing ) { for ( int i=0; i < things.size(); i++ ) { if ( thing.equals( things.get( i ) ) ) { return true; } } return false; } Update: Minor edit to add missing parenthesis from if statement that got "lost in translation" en-route to the blog :)

Configuring Mac OS X Terminal

The post you're reading is ancient, and yet slightly inexplicably popular :) I've recently started blogging again in 2020 with some fresh content. Check out some of the new topics about blogging again, dynamic method invocation, and aapt2.I recently installed Leopard (Mac OSX 10.5) on a new mac. There are a few factory settings I usually change on a new installation, although by far fewer than I do typically with Windows. One of them is the default keyboard configuration for Ctrl+Left Arrow, Ctrl+Right Arrow, Page Up, Page Down, Home, and End in Terminal. The default settings drive me a bit potty since I'm used to using Linux and emacs every day at work.Changing them is easy, fortunately. Just visit Keyboard under Settings in Terminal->Preferences, and modify the following keys, so that their action matches the value shown. You can edit the keystroke for an item by double clicking on it, selecting "send string to shell", and typing the indicated keys.KeyActio…

Java Blooper #1: Ternary Insanity

The post you're reading is ancient, and yet slightly inexplicably popular :) I've recently started blogging again in 2020 with some fresh content. Check out some of the new topics about blogging again, dynamic method invocation, and aapt2.From time to time, we all write code that could be clearer. Sometimes in the rush of solving a problem, we don't pay attention to the micro details of the code flowing from our fingertips. Other times, we refactor some existing code, and don't necessarily take the opportunity to clean up as much as we could.I find it useful sometimes when reading code to think about whether it could be rewritten in a more straightforward way, and if so whether any lessons can be learned about writing tight and expressive, and most importantly, readable code.Over the next few weeks, I'm going to blog weekly examples of some Java code bloopers that I've seen. All the examples are real and have been observed "in the wild". However some…