mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 07:24:39 +01:00
Disable rprompt + handle disabled rprompt case
This commit is contained in:
parent
5301fbffbe
commit
a9557c127e
3 changed files with 21 additions and 9 deletions
6
bash/ext
6
bash/ext
|
|
@ -101,7 +101,11 @@ function apply_prompt_rprompt() {
|
|||
local prompt=$(echo "${PROMPT}" | sub_prompt_colors_sized)
|
||||
#local rprompt=$(echo "${RPROMPT}" | strip_prompt_colors)
|
||||
#local prompt=$(echo "${PROMPT}" | strip_prompt_colors)
|
||||
PS1="$(printf "\[%*s\r\]%s" "${COLUMNS}" "${rprompt:-}" "${prompt:-}")"
|
||||
if [[ -n "${RPROMPT}" ]]; then
|
||||
PS1="$(printf "\[%*s\r\]%s" "${COLUMNS}" "${rprompt:-}" "${prompt:-}")"
|
||||
else
|
||||
PS1="${prompt:-}"
|
||||
fi
|
||||
}
|
||||
|
||||
# vim: ft=bash
|
||||
|
|
|
|||
|
|
@ -116,7 +116,11 @@ set_prompt() {
|
|||
|
||||
[[ ${CMD_RC} -ne 0 ]] && rbuffer=" %F{red}${CMD_RC}${rbuffer}"
|
||||
|
||||
RPROMPT="${rbuffer}%f"
|
||||
if [[ -n "${rbuffer}" ]]; then
|
||||
RPROMPT="${rbuffer}%f"
|
||||
else
|
||||
RPROMPT=""
|
||||
fi
|
||||
}
|
||||
|
||||
# vim: ft=bash
|
||||
|
|
|
|||
18
zsh/prompt
18
zsh/prompt
|
|
@ -179,15 +179,19 @@ set_prompt() {
|
|||
|
||||
local rbuffer=""
|
||||
|
||||
if [[ ${CMD_DURATION:-0} -gt 0 ]]; then
|
||||
printf -v formatted_duration "%.3f" "${CMD_DURATION}"
|
||||
# if [[ ${CMD_DURATION:-0} -gt 0 ]]; then
|
||||
# printf -v formatted_duration "%.3f" "${CMD_DURATION}"
|
||||
|
||||
rbuffer=" %F{yellow}${formatted_duration}s${rbuffer}"
|
||||
# rbuffer=" %F{yellow}${formatted_duration}s${rbuffer}"
|
||||
# fi
|
||||
|
||||
# [[ ${CMD_RC} -ne 0 ]] && rbuffer=" %F{red}${CMD_RC}${rbuffer}"
|
||||
|
||||
if [[ -n "${rbuffer}" ]]; then
|
||||
RPROMPT="${rbuffer}%f"
|
||||
else
|
||||
RPROMPT=""
|
||||
fi
|
||||
|
||||
[[ ${CMD_RC} -ne 0 ]] && rbuffer=" %F{red}${CMD_RC}${rbuffer}"
|
||||
|
||||
RPROMPT="${rbuffer}%f"
|
||||
}
|
||||
|
||||
# vim: ft=zsh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue