diff options
Diffstat (limited to 'zsh/.zsh/functions/cdp')
-rw-r--r-- | zsh/.zsh/functions/cdp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/zsh/.zsh/functions/cdp b/zsh/.zsh/functions/cdp new file mode 100644 index 0000000..0fe9697 --- /dev/null +++ b/zsh/.zsh/functions/cdp @@ -0,0 +1,13 @@ +# -*- mode: sh; -*- +local _pwd=$(pwd) + +while; do + cd .. + [[ ! -d '.git' && "$(pwd)" != "/" ]] || break +done + +if [[ "$(pwd)" == "/" ]]; then + cd $_pwd + echo 'Project root not found' >&2 + return 1 +fi |