Skip to content

Commit

Permalink
Simplified _agkozak_prompt_dirtrim() logic
Browse files Browse the repository at this point in the history
  • Loading branch information
agkozak committed Dec 23, 2017
1 parent 5e288b5 commit 0b0245e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions agkozak-zsh-theme.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,11 @@ _agkozak_prompt_dirtrim() {
[[ $1 -ge 1 ]] || set 2
local abbreviated_path
case $PWD in
$HOME) print -n '~' ;; # For TrueOS
$HOME*)
abbreviated_path=$(print -Pn "%($(($1 + 2))~|~/.../%${1}~|%~)")
abbreviated_path=$(print -Pn "%($(($1 + ${#HOME//[^\/]/}-1))~|~/.../%$1~|%~)")
;;
*)
abbreviated_path=$(print -Pn "%($(($1 + 1))~|.../%${1}~|%~)")
abbreviated_path=$(print -Pn "%($(($1 + 1))~|.../%$1~|%~)")
;;
esac
print -n "$abbreviated_path"
Expand Down

0 comments on commit 0b0245e

Please sign in to comment.