Merging @dritter's work to allow shortened dir segment.

This is PR #54.
Merge remote-tracking branch 'dritter/dritter/shorten_dir_path'
This commit is contained in:
Ben Hilburn 2015-07-12 18:07:59 -07:00
commit 20cb4a245e
2 changed files with 15 additions and 1 deletions

View file

@ -443,7 +443,13 @@ prompt_context() {
# Dir: current working directory
prompt_dir() {
$1_prompt_segment "$0" "blue" "$DEFAULT_COLOR" '%~'
local current_path='%~'
if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" ]]; then
# shorten path to $POWERLEVEL9K_SHORTEN_DIR_LENGTH
current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:.../:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c"
fi
$1_prompt_segment "$0" "blue" "$DEFAULT_COLOR" "$current_path"
}
# Command number (in local history)