Alternatively, one can use static named directory. It has the advantage of being expanded at any place, so it works with any command, not just with cd.
Wow! I had no idea such a thing existed. Definitely it looks like a more complete solution than mine, although also more complex. Still good to learn something new :)
Alternatively, one can use static named directory. It has the advantage of being expanded at any place, so it works with any command, not just with
cd
.Is this approach zsh only?
Yes. AFAIK, bash does not have this.
Wow! I had no idea such a thing existed. Definitely it looks like a more complete solution than mine, although also more complex. Still good to learn something new :)
I also like the words of wisdom thar you can just use shell variables.
https://vincent.bernat.ch/en/blog/2015-zsh-directory-bookmarks#fn-variables
You only lose the prompt expansion.
I use zoxide (from the autojump family of tools) and let my computer remember my frequently used directories for me.
(AFAIK autojump inspired j inspired j2 inspired z inspired z.lua inspired zoxide.)
I also use zoxide because it supports both Powershell and fish unlike many of its predecessors
I’ve been using this solution with a slight modification,. It is basically the same idea, but creates custom commands instead of modifying CDPATH.