3 ms·
A project-specific zsh[0] function I find quite handy is: devhome () { cd $DEV_HOME/${~1}(/) } This assumes an environment variable DEV_HOME is assigne
by AdieuToLogic 2y ago
A project-specific zsh[0] function I find quite handy is:
devhome () {
cd $DEV_HOME/${~1}(/)
}
This assumes an environment variable DEV_HOME is assigned to be the location of the top-level directory for a given project. An example of its use is:
devhome mod*/foo/src/**/some-dir
0 - https://www.zsh.org/ https://www.zsh.org/
- arccy 2y agoi mostly use this to go from inside a repo up to the root: alias rr='cd $(git rev-parse --show-toplevel)'
- AdieuToLogic 2y agoThis is certainly a viable alternative to requiring a project-specific environment variable. The downside is it can only succeed if $PWD is within the local git repo. If this is the preferred approach, however, an alternative zsh definition for devhome could be: devhome () { cd $(git rev-parse --show-toplevel) && cd ./${~1}(/) }