From 1e90b5766c36b0b947184310910aa1e38320bec5 Mon Sep 17 00:00:00 2001 From: bretello Date: Thu, 9 May 2024 12:37:39 +0200 Subject: [PATCH] zsh: themes: fix prompt_too_long usage --- themes/brethil.zsh-theme | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/themes/brethil.zsh-theme b/themes/brethil.zsh-theme index d432f18..caf4d0b 100644 --- a/themes/brethil.zsh-theme +++ b/themes/brethil.zsh-theme @@ -78,15 +78,17 @@ local success="%B%F{28} →%f%b" local failure="%B%{$fg[red]%} x%b%{$reset_color%}" local prompt_with_previous_return_status="%(?:$success:$failure) " -# prints a newline if more than $COLUMNS/2 characters have been printed, see end of `man zshmisc` -local prompt_too_long='%-$((COLUMNS/2))(l..'$'\n'')' +function prompt_too_long(){ + # prints a newline if less than $COLUMNS/2 characters remain to the right margin, see end of `man zshmisc` + echo "%-$((COLUMNS/2))(l..\n)" +} ## oh-my-zsh vi-mode plugins indicators: export MODE_INDICATOR="[%B%K{red}nav%k%b]" # red background export INSERT_MODE_INDICATOR="[%B%K{28}ins%k%b]" # green background # put it all together -PROMPT='$(virtualenv_info)'"${user_prompt}${path_prompt}${git_prompt}${job_prompt}${shlvl_prompt}${prompt_too_long}${prompt_with_previous_return_status}" +PROMPT='$(virtualenv_info)'"${user_prompt}${path_prompt}${git_prompt}${job_prompt}${shlvl_prompt}$(prompt_too_long)${prompt_with_previous_return_status}" # Right prompt is just return code and time RPS1="${return_code_RPS1}"'$(vi_mode_prompt_info)[%*]'