diff --git a/functions/prompt-pwd b/functions/prompt-pwd index 5a2d508..878ab75 100644 --- a/functions/prompt-pwd +++ b/functions/prompt-pwd @@ -1,11 +1,17 @@ # vim:et sts=2 sw=2 ft=zsh setopt LOCAL_OPTIONS EXTENDED_GLOB -local git_root current_dir separator +local git_root current_dir separator path_format path_length local -i dir_length +zstyle -s ':zim:prompt-pwd:path-format' format 'path_format' || path_format="" +zstyle -s ':zim:prompt-pwd:path-length' path-length 'path_length' || path_length=0 if zstyle -t ':zim:prompt-pwd' git-root && \ git_root=$(command git rev-parse --show-toplevel 2>/dev/null); then - current_dir="${PWD#${git_root:h}/}" + current_dir="${$(pwd -P)#${git_root:h}/}" +elif [[ -n $path_format ]]; then + current_dir="$path_format" +elif [[ $path_length -gt 0 ]]; then + current_dir=%($((path_length+2))~|%-1~/.../%$path_length~|%~) else current_dir=${(%):-%~} fi