Autojump: a cd command that learns
wiki.github.com
wiki.github.com
export CDPATH=($HOME/common:$HOME/repos)
You'd have to manually symlink your favorite directories into ~/common, of course.
The directories listed in $CDPATH are made available to `cd` no matter what directory you are in, so if you have ~/common/downloads, you can type `cd downloads` from any directory. Tab-completion works with this too.
Not to downplay autojump -- I just prefer this approach since I explicitly control all the directories I want quick access to, and my `cd` command is deterministic (assuming I name directories to avoid conflicts).
Discussed on reddit here: http://www.reddit.com/r/programming/comments/7y4ap/where_the...
Update: Ah, I knew there was another j a year ago: http://news.ycombinator.com/item?id=485053. (And I pushed my version there as well :/)
* Makes it possible to jump to a relative path (e.g. `j ../models`)
* Possible to specify multiple patterns, e.g. `j my_project static`
http://github.com/amix/autojump/commit/f5fff8d8c0c6e8ce676aa...
Although, it doesn't really help if you need to jump to an obscure part of the filesystem.
it doesn't learn, but rather you create bookmarks with simple aliases. The nicest part is that it's set up so you can tab-complete bookmarks and subsequent subdirs.
I've just reinstalled it to check out, and I've noticed a couple of things that I dislike:
1) it doesn't seem to consistently tab-complete (j <tab><tab> returns a bunch of __1__/some/path entries) 2) It's not easy to cycle through/view multiple matches 3) I'm not sure how to modify the database (eg: when I complete a project and archive stuff, I probably don't want to jump there anymore, even though it might be quite highly rated)
cdargs deals with most of these things in a better way, but doesn't have any of the learning features. I've used it now for a few months, and I'm in the process of hacking at it a bit to make it fit better into my workflow.
One useful tip that applies probably equally to both is to add something like:
"\C-f": "\C-a\C-kcdd \t\t"
into ~/.inputrc for a binding style completion.
The bunch of __1__ entries are the best matches, and you simply need to add the number you want and another tab to finish the completion. It's a bit hackish, but it works fine! Maybe I should document this somewhere though :)
You can't directly edit the database, however autojump automatically removes directories that are not there anymore. Thus if you're done with a project, simply move the directory to archive/ or something, and autojump will forget about it. Otherwise the exponential decay works fast enough anyways.
I understand learning systems are not for everybody, though. With autojump, I tried to make the behavior of the system as predictable as possible, but it's not and will never be fully deterministic. I accept this as a necessary bad counterpart to the nice features autojump has, but I understand some people will never like it.
A few extra keystrokes is a good trade to get predictability.
It's a bit of a hack (a combo of Perl and bash scripting) -- something anyone on HN could probably put together in no time, but it does the job. I've been using it for 2 or 3 years now, and I find it to be extremely useful and a decent time saver.
Could it be because you haven't trained the database?
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fiEdit: scratch that. I have tab completion of things in the database, but not of paths! Much, much less usable than cd for going to places I haven't been before, which is probably half of my usage. Oh well.
In any case I'd recommend to try it for a bit, I've seen quite a lot of people changing their minds after using it for a couple days. Sure, you can emulate the functionality with aliases and so on, but this is fully automatic, and after a few days, you might very well be thinking, "why didn't I use this all along?" :)