diff options
| author | Bart Schaefer <schaefer@zsh.org> | 2025-10-27 20:21:27 -0700 |
|---|---|---|
| committer | Bart Schaefer <schaefer@zsh.org> | 2025-10-27 20:21:27 -0700 |
| commit | 5f07437f9f814653bcb9d2abe306c7fe51443af5 (patch) | |
| tree | db2a1a478101110374e30cb965d138bb1d507181 /Functions/Prompts | |
| parent | 53676+54009: Revise 52650+51945 for assignment to global through nameref (diff) | |
| download | zsh-5f07437f9f814653bcb9d2abe306c7fe51443af5.tar zsh-5f07437f9f814653bcb9d2abe306c7fe51443af5.tar.gz zsh-5f07437f9f814653bcb9d2abe306c7fe51443af5.tar.bz2 zsh-5f07437f9f814653bcb9d2abe306c7fe51443af5.tar.lz zsh-5f07437f9f814653bcb9d2abe306c7fe51443af5.tar.xz zsh-5f07437f9f814653bcb9d2abe306c7fe51443af5.tar.zst zsh-5f07437f9f814653bcb9d2abe306c7fe51443af5.zip | |
Dan Drake: 53803: make adam1 prompt wrap len and ellipsized path configurable
Diffstat (limited to 'Functions/Prompts')
| -rw-r--r-- | Functions/Prompts/prompt_adam1_setup | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Functions/Prompts/prompt_adam1_setup b/Functions/Prompts/prompt_adam1_setup index 27a613ca1..b88ffc7c1 100644 --- a/Functions/Prompts/prompt_adam1_setup +++ b/Functions/Prompts/prompt_adam1_setup @@ -22,6 +22,8 @@ prompt_adam1_setup () { prompt_adam1_color1=${1:-'blue'} prompt_adam1_color2=${2:-'cyan'} prompt_adam1_color3=${3:-'green'} + prompt_wrap_length=${4:-40} + prompt_path_ellipsize_num=${5:-4} base_prompt="%K{$prompt_adam1_color1}%n@%m%k " post_prompt="%b%f%k" @@ -39,10 +41,10 @@ prompt_adam1_precmd () { local prompt_length space_left base_prompt_expanded_no_color=$(print -P "$base_prompt_no_color") - base_prompt_etc=$(print -P "$base_prompt%(4~|...|)%3~") + base_prompt_etc=$(print -P "$base_prompt%($((${prompt_path_ellipsize_num} + 1))~|...|)%${prompt_path_ellipsize_num}~") prompt_length=${#base_prompt_etc} - if [[ $prompt_length -lt 40 ]]; then - path_prompt="%B%F{$prompt_adam1_color2}%(4~|...|)%3~%F{white}" + if [[ $prompt_length -lt $prompt_wrap_length ]]; then + path_prompt="%B%F{$prompt_adam1_color2}%($((${prompt_path_ellipsize_num} + 1))~|...|)%${prompt_path_ellipsize_num}~%F{white}" else space_left=$(( $COLUMNS - $#base_prompt_expanded_no_color - 2 )) path_prompt="%B%F{$prompt_adam1_color3}%${space_left}<...<%~$prompt_newline%F{white}" |
