3 ms·
The `cd ...` aliases are an interesting choice; I find it more practical to use `autocd` in combination with named directories. setopt autocd hash -d dev=~
by wrboyce 6y ago
The `cd ...` aliases are an interesting choice; I find it more practical to use `autocd` in combination with named directories.
setopt autocd
hash -d dev=~/dev
Now I can just use `~dev` to `cd ~/dev` but I can also do `~dev/foo/bar/baz` etc.
- jchook 6y agoI have fallen in love with `z` e.g. `z p` might take you to ~/projects if you've been there recently. https://github.com/skywind3000/z.lua https://github.com/skywind3000/z.lua
- wrboyce 6y agoGood point, I'm a huge fan of `fasd` which provides similar features. I feel lost in a shell without `z` now! https://github.com/clvv/fasd https://github.com/clvv/fasd
- chrisfinazzo 6y agoDoes this work backwards, too? For example if I'm in "/Documents/Dotfiles", but want to go to "/Documents/Blog". Doing the "../" dance is tedious as hell.
- sk5t 6y ago'z' should work well here - 'z D B'
- chrisfinazzo 6y agoSigh, again, I should have looked this up... % Documents/Dotfiles [~/Documents/Dotfiles] % ../Blog This does the trick.
- skoskie 6y agoSimilarly, project autocompletion for the directory where I do my web dev ... export SITES=$HOME/Sites # Plural to cd and list contents alias sites="cd $SITES; ll" # Singular to access a particular project site() { cd $SITES/$1; } # Autocomplete function _site() { _directories -W $SITES -/; } compdef _site site It works from within any directory, which is nice. site f[tab][enter] takes me to $SITES/foo/