allow manually adding an alias for a directory
jesseduffield opened this issue · 2 comments
For a while I've been using z api
to go to my 'api' repo, however recently another path has ended up having a higher precedence and so I end up being sent to there. I would like to be able to do something like the following:
z --alias api /path/to/api
So that I'm locking the api
string to that particular path.
Alternatively I can use a different tool to achieve this, but I feel like this functionality makes sense for z to include itself, if only for the sake of relying on muscle memory.
My recommendation would be to use the Zsh builtin feature of named directories:
hash -d api=/path/to/api
That way you can type
cd ~api
And you're there. If you enable setopt CDABLE_VARS
, you don't have to type the tilde:
cd api
And if you enable setopt AUTOCD
, you can just type
api
Thanks for the quick response, I'll take that approach