9 ms·
I use zsh, and I have a thing in my profile that skips writing any `cd` command to history. Instead, it will rewrite the command using the absolute path of the
by dasl 7y ago
I use zsh, and I have a thing in my profile that skips writing any `cd` command to history. Instead, it will rewrite the command using the absolute path of the directory I `cd`'d into and write that to history.
Thus, all of the `cd` commands that get written to my history use absolute paths and are re-usable no matter where I am.
It would be cool if this sort of functionality were generalizable to all commands where you type a relative path, not just `cd`.
https://github.com/dasl-/settings/blob/3143bbfe23bd75c3e35c76350355fba2fe25fce8/.zshrc#L95-L114 https://github.com/dasl-/settings/blob/3143bbfe23bd75c3e35c7...
- smacke 7y agoYou might enjoy checking out 'fasd', which, among other things, creates an alias ('zz') with autocomplete functionality for changing to frequently-used directories. https://github.com/clvv/fasd https://github.com/clvv/fasd
- isatty 7y agoOr just github.com/rupa/z
- dual_basis 7y agoIn fish, suggested autocompletions are contextual. For example, if I am in /home/dual_basis/projectA and I type `cd some/subdir` then a bunch of time goes by when I come back to /home/dual_basis/projectA and start typing `cd` it will suggest `cd some/subdir`, even if I have typed a bunch of other `cd` commands while in other directories. This isn't specific to `cd` commands either. It's useful if you are `rsync`ing different directories to different places, or checkout different `git` branches, etc.
- tyingq 7y agoThat seems like it would be tricky for it not to screw something up. Like, for example, would it handle this properly? $ (cd /source;tar -cf - .) | (cd /dest;tar -xf -)