In zsh you can use ~varname as directory shortcuts; for example I have this:
And then cd ~pack/plugin.vim or vim ~d/file.markdown works. There’s also the CDABLE_VARS setting to make the ~ optional.
Even without this feature, you can use vim $d/file.markdown in any shell.
I’m not so familiar with bash, so I don’t know if it has an equivalent feature (it doesn’t work in quick test), but on zsh at least this script seems rather redundant?
cdable_vars is the closest feature in bash
This smells like tcsh and cdpath.
Interesting project! It seems like a very similar system to warp directory, what are the advantages of using goto instead of wd?
The idea has come up quite a bit over the years, at varying levels of quality. https://github.com/huyng/bashmarks is the old version of it I’ve seen, but isn’t friendly to file paths with spaces.
I ended up making 3 versions of something similar for myself, one in bash, one in Go, and then I ported the database manager to Nim. I’ve started to see it as the shell equivalent of making your own blogging software, and a great way to make your shell suck a lot less.
Thanks for bringing warp to my attention. I didn’t know about it, goto indeed looks very similar to it. I am not familiar with zsh and I can’t fully compare them, I built goto for the Bash shell, its zsh functionality was added by contributors. If I find the time, I’ll give warp a try and come back to you.
I’ve never really understood the point in these tools. Symlinks in ~ are simple enough to justify the 3 extra characters over something like autojump.
One thing I’ve been doing lately is keeping a directory on $HOME called l (the actual letter doesn’t matter that much, but the fact that it is as short as it can be). All directories and symlinks that I access on a frequent basis are there. So all that I usually need to do is to cd ~/l/whatever.
This works for me, in conjunction with pushd and popd to manage short-lived workflows when required.
If you use home-manager (NixOS, in particular), there is autojump.
I created my own shell script for that, and then use homebrew’s choose (macos) to jump to memorized paths, and also navigate inside (Used fzf before).
I don’t find much utility in maintaining a database of links manually. My more simple take on this concept uses a list of search paths and facilitates jumping to any directory within a search path, by name. I use it to cd amongst the zillions of repos I have checked out.