summaryrefslogtreecommitdiff
path: root/tw/home/files/prompt.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'tw/home/files/prompt.zsh')
-rw-r--r--tw/home/files/prompt.zsh7
1 files changed, 5 insertions, 2 deletions
diff --git a/tw/home/files/prompt.zsh b/tw/home/files/prompt.zsh
index 15e2d49b..7cc7342b 100644
--- a/tw/home/files/prompt.zsh
+++ b/tw/home/files/prompt.zsh
@@ -59,8 +59,11 @@ prompt_fast_preexec () {
}
prompt_fast_pwd () {
- local fast_path="$(print -Pn '%~')"
- if (($#fast_path / $COLUMNS.0 * 100 > ${PROMPT_FAST_PATH_PERCENT:-33})); then
+ local fast_path=$(print -Pn '%~')
+ local components=${#fast_path//[^\/]} # this counts the initial /
+ # Only abbreviate as /1/…/2/3 if we have something to cut out between 1 and 2!
+ # /1/2/3 -> /1/…/2/3 makes no sense.
+ if ((components > 3 && $#fast_path > ${PROMPT_FAST_PATH_FRACTION:-0.33} * COLUMNS)); then
print -Pn '%-1~/…/%2/'
else
print "$fast_path"