Showing posts with label tips and tricks. Show all posts
Showing posts with label tips and tricks. Show all posts

Thursday, July 10, 2008

cdargs

I'm a fan of aliases and basically anything else that can help me type less when doing stuff on the command line. My home directory often has a number of symbolic links to various projects and libraries, and 'til now I've gotten by with this amalgamation of tools and techniques just fine.

Still, I'm always looking out for new tips and tricks, and one of the best and easiest ways to pick up some invaluable knowledge from others is to see how they use their shell. I forget sometimes that some of the shortcuts I know and love aren't used by others; I've had people say "wait, what was that?" when I do


$ mkdir something_here
$ cd !$


or even a simple !!, !mer, ctrl+r rake, etc. Still, you can only know so much, and recently I was that person saying "waaaiiit a sec..." while watching wycats fly around various directories with this little command 'cv'.

Enter cdargs



Take a look at its homepage here http://www.skamphausen.de/cgi-bin/ska/CDargs and come back when done scanning.

If you follow the instructions you'll have a nice and small 'cv' command at your disposal. Now, maybe it was related to the fact that I was doing this at 3am, but I definitely didn't get it at first, and its actually quite simple.

In browse mode you can easily traverse your file system and type 'a' along the way to add directories to your list. This means that you can just type 'cv' from anywhere, easily select something from your list, and change to it quickly. Nice, but still a little verbose for my liking. However, you can also use a name from your list and cv to it directly, which is just damn cool.

So, an example. My current list looks something like this:

0 [merb ] /Users/jackdempsey/git/merb
1 [thor ] /Users/jackdempsey/git/thor
2 [dm ] /Users/jackdempsey/git/dm
3 [git ] /Users/jackdempsey/git
4 [recollectr] !/Users/jackdempsey/recollectr
6 [testbed ] /Users/jackdempsey/testbed


Which means from any location i can type 'cv git' or 'cv merb' etc and jump to the directory directly. So much nicer than the 'cd ~/symbolic_link_here' that I've gotten used to.

So try it out. I think its one of those things that as soon as you build up the muscle memory for it, you'll never want to go back. Much thanks to Yehuda for showing me the light on this one.