diff --git a/modules/prompt/README.md b/modules/prompt/README.md index dd5349e2..e106f2b8 100644 --- a/modules/prompt/README.md +++ b/modules/prompt/README.md @@ -26,6 +26,14 @@ in *zpreztorc*. zstyle ':prezto:module:prompt' pwd-length 'short' ``` +### Prompt Display Length + +To change working directory prompt display length from 'short', set the +following to 'long' (without '~' expansion) or 'full' (with '~' expansion) +in *zpreztorc*. + + zstyle ':prezto:module:prompt' pwd-length 'short' + Theming ------- diff --git a/modules/prompt/functions/promptpwd b/modules/prompt/functions/prompt-pwd similarity index 75% rename from modules/prompt/functions/promptpwd rename to modules/prompt/functions/prompt-pwd index bf6e227d..53613e72 100644 --- a/modules/prompt/functions/promptpwd +++ b/modules/prompt/functions/prompt-pwd @@ -1,7 +1,11 @@ -# prompt setup function common to many prompts -# moved to external function to reduce code redundancy +# +# Prompt setup function commonly used by prompt themes. +# +# Authors: +# Sorin Ionescu +# -# function promptpwd { +# function prompt-pwd { setopt localoptions extendedglob @@ -19,6 +23,8 @@ else ret_directory="${${${${(@j:/:M)${(@s:/:)current_pwd}##.#?}:h}%/}//\%/%%}/${${current_pwd:t}//\%/%%}" fi +unset current_pwd + print "$ret_directory" # } diff --git a/modules/prompt/functions/prompt_damoekri_setup b/modules/prompt/functions/prompt_damoekri_setup index 89e4d758..ca3b09ec 100644 --- a/modules/prompt/functions/prompt_damoekri_setup +++ b/modules/prompt/functions/prompt_damoekri_setup @@ -16,7 +16,7 @@ prompt_damoekri_precmd() { unsetopt XTRACE KSH_ARRAYS # Format PWD. - _prompt_damoekri_pwd=$(promptpwd) + _prompt_damoekri_pwd=$(prompt-pwd) # Get Git repository information. if (( $+functions[git-info] )); then diff --git a/modules/prompt/functions/prompt_paradox_setup b/modules/prompt/functions/prompt_paradox_setup index c5a87515..088e77e4 100644 --- a/modules/prompt/functions/prompt_paradox_setup +++ b/modules/prompt/functions/prompt_paradox_setup @@ -84,7 +84,7 @@ function prompt_paradox_precmd { unsetopt XTRACE KSH_ARRAYS # Format PWD. - _prompt_paradox_pwd=$(promptpwd) + _prompt_paradox_pwd=$(prompt-pwd) # Get Git repository information. if (( $+functions[git-info] )); then diff --git a/modules/prompt/functions/prompt_sorin_setup b/modules/prompt/functions/prompt_sorin_setup index 3a2a9f71..b37af7f8 100644 --- a/modules/prompt/functions/prompt_sorin_setup +++ b/modules/prompt/functions/prompt_sorin_setup @@ -82,7 +82,7 @@ function prompt_sorin_precmd { unsetopt XTRACE KSH_ARRAYS # Format PWD. - _prompt_sorin_pwd=$(promptpwd) + _prompt_sorin_pwd=$(prompt-pwd) # Define prompts. RPROMPT='${editor_info[overwrite]}%(?:: %F{1}⏎%f)${VIM:+" %B%F{6}V%f%b"}' diff --git a/runcoms/zpreztorc b/runcoms/zpreztorc index 9fbc4f6a..31368d1c 100644 --- a/runcoms/zpreztorc +++ b/runcoms/zpreztorc @@ -97,7 +97,9 @@ zstyle ':prezto:module:editor' key-bindings 'emacs' # Auto set to 'off' on dumb terminals. zstyle ':prezto:module:prompt' theme 'sorin' -# Set how themes that use promptpwd function display the pwd, can be 'short', 'long', or 'full' +# Set the working directory prompt display length. +# By default, it is set to 'short'. Set it to 'long' (without '~' expansion) +# for longer or 'full' (with '~' expansion) for even longer prompt display. # zstyle ':prezto:module:prompt' pwd-length 'short' #