Add shortened path mark user configuration

This commit is contained in:
Jean-Sebastien Leroy 2013-03-21 21:22:20 +01:00
parent f23bac5325
commit 9e53b9a0a7
2 changed files with 4 additions and 1 deletions

View File

@ -20,6 +20,7 @@ if [[ "$(locale -k LC_CTYPE | sed -n 's/^charmap="\(.*\)"/\1/p')" == *"UTF-8"* ]
LP_MARK_FOSSIL="⌘" # prompt mark in fossil repositories
LP_MARK_UNTRACKED="*" # if git has untracked files
LP_MARK_STASH="+" # if git has stashs
LP_MARK_SHORTEN_PATH="…" # prompt mark in shortened paths
else
# If charset is anything else, fallback to ASCII chars
LP_MARK_BATTERY="b"
@ -32,6 +33,7 @@ else
LP_MARK_FOSSIL="f"
LP_MARK_UNTRACKED="*"
LP_MARK_STASH="+"
LP_MARK_SHORTEN_PATH="..."
fi
# Do not prefix the prompt

View File

@ -231,6 +231,7 @@ _lp_source_config()
LP_MARK_STASH=${LP_MARK_STASH:-"+"}
LP_MARK_BRACKET_OPEN=${LP_MARK_BRACKET_OPEN:-"["}
LP_MARK_BRACKET_CLOSE=${LP_MARK_BRACKET_CLOSE:-"]"}
LP_MARK_SHORTEN_PATH=${LP_MARK_SHORTEN_PATH:-" … "}
LP_COLOR_PATH=${LP_COLOR_PATH:-$BOLD_WHITE}
LP_COLOR_PATH_ROOT=${LP_COLOR_PATH_ROOT:-$BOLD_YELLOW}
@ -431,7 +432,7 @@ _lp_shorten_path()
return
fi
# the character that will replace the part of the path that is masked
local mask=""
local mask="$LP_MARK_SHORTEN_PATH"
# index of the directory to keep from the root (starts at 0 whith bash, 1 with zsh)
local keep=$((LP_PATH_KEEP-1))
if [[ "$_LP_WORKING_SHELL" == "zsh" ]]; then