Adds dirstack segment to powerline themes

This commit is contained in:
David Farrell
2019-10-31 22:33:40 -07:00
parent 1383af0ca8
commit f8ae0494e8
5 changed files with 23 additions and 0 deletions

View File

@@ -170,6 +170,17 @@ function __powerline_shlvl_prompt {
fi
}
function __powerline_dirstack_prompt {
if [[ "${#DIRSTACK[@]}" -gt 1 ]]; then
local depth=$(( ${#DIRSTACK[@]} - 1 ))
local prompt="${DIRSTACK_THEME_PROMPT_CHAR}"
if [[ "${depth}" -ge 2 ]]; then
prompt+="${depth}"
fi
echo "${prompt}|${DIRSTACK_THEME_PROMPT_COLOR}"
fi
}
function __powerline_left_segment {
local OLD_IFS="${IFS}"; IFS="|"
local params=( $1 )

View File

@@ -64,6 +64,9 @@ HOST_THEME_PROMPT_COLOR=${POWERLINE_HOST_COLOR:=0}
SHLVL_THEME_PROMPT_COLOR=${POWERLINE_SHLVL_COLOR:=${HOST_THEME_PROMPT_COLOR}}
SHLVL_THEME_PROMPT_CHAR=${POWERLINE_SHLVL_CHAR:="§"}
DIRSTACK_THEME_PROMPT_COLOR=${POWERLINE_DIRSTACK_COLOR:=${CWD_THEME_PROMPT_COLOR}}
DIRSTACK_THEME_PROMPT_CHAR=${POWERLINE_DIRSTACK_CHAR:="←"}
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"}
safe_append_prompt_command __powerline_prompt_command