Re:J: an alternative to cd that learns where you spend time
by brunoqc on Tuesday February 17, 2009 @06:32PM
(#485152)
Post like you just did should have a mandatory link to the code :)
Re:J: an alternative to cd that learns where you spend time
by calambrac on Tuesday February 17, 2009 @06:42PM
(#485163)
There's a python portion:
http://pastebin.com/f16aae31d
And a small bash function (since you can only change your shell's pwd from the shell itself):
Re:J: an alternative to cd that learns where you spend time
by brunoqc on Tuesday February 17, 2009 @06:50PM
(#485172)
Thanks!
Re:J: an alternative to cd that learns where you spend time
by jrockway on Tuesday February 17, 2009 @07:11PM
(#485189)
The name "sd" conflicts with this, however:
http://github.com/obra/sd/tree/master
Yay for two-letter identifiers. ;)
Kind of but not really in a similar vein: I have 'sd' aliased to a small script that goes to the 'next interesting directory', where an 'interesting directory' is one with a visible non-directory or more than one sub-directory. So, for instance, if you're sitting at foo, and underneath you is bar/baz/bat/bit.txt, 'sd bar' will bring you all the way down to bat, and then 'sd ..' will pull you all the way back up to the previous interesting directory.
Just to keep from getting lost, it does a pwd when it gets where it's going, and because typing ls after cd had burned itself into my muscle memory, it goes ahead and does that, too.
It's a small thing, but I really like it for hopping around source trees in languages that use directories to denote package structure.