Skip to content

Commit

Permalink
Allow to change format of non-git paths
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoCampinoti94 committed Oct 27, 2021
1 parent 40b4dba commit 9a9cd54
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion functions/prompt-pwd
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# 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
local -i dir_length
zstyle -s ':zim:prompt-pwd:path-format' format 'path_format' || path_format=""
if zstyle -t ':zim:prompt-pwd' git-root && \
git_root=$(command git rev-parse --show-toplevel 2>/dev/null); then
current_dir="${$(pwd -P)#${git_root:h}/}"
elif [[ -n $path_format ]]
current_dir="$path_format"
else
current_dir=${(%):-%~}
fi
Expand Down

0 comments on commit 9a9cd54

Please sign in to comment.