▲ | cassepipe 3 days ago | |
Interesting ! I have this alternative in my zsh config:
Then I can just use ~c, ~d or ~dd or anything temporary I want to put there | ||
▲ | cb321 3 days ago | parent [-] | |
`hash -d` (aka "named directories") is surely an alternative and if that suits you, by all means. I see at least two downsides: 1) now you have to remember to say `make -C ~c` { not `make -C $c` which I think most would find more natural } 2) the hash cannot be exported to inheriting subprocesses like a regular scalar $var. Of course, 1) is kind of weak since you can also use "~var" most places. It's just not as familiar to many as $var. One notable equivalency is that Zsh prompt escapes for $PS1 and friends like %~ would treat both the same - converting them to a "~c" inside your prompt. So, in terms of "looking like what you type", that maybe makes ~c better. Maybe there is some setopt to make Zsh expand %~ as $c or $dd? Not sure. There are a lot of setopts. Anyway, I actually use the exporting feature to non-Zsh subprocesses myself. So, I'm pretty locked-in to vars not just hash entries. |