dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit f32d9a82b1caf365af742f120365dd759860d5e9
parent 78dfcd5ae2268ed2c6ba66292bcb1d6ac5f3da4d
Author: hhvn <dev@hhvn.uk>
Date:   Thu, 27 May 2021 19:11:40 +0100

.c/k/kshrc .c/k/prompt: strip \[ \]

Diffstat:
M.config/ksh/kshrc | 2+-
M.config/ksh/prompt | 6++++++
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/.config/ksh/kshrc b/.config/ksh/kshrc @@ -18,7 +18,7 @@ settitle(){ printf "\[\033]0;%s\007\]" "$@" } -PS1="\$(__ksh_prompt \$?)\$(settitle ksh)" +PS1="\$(__ksh_prompt \$? | __prompt_strip)\$(settitle ksh | __prompt_strip)" PS2="$(tput setaf 7):; $(tput sgr0)" PS3="$(tput setaf 7):; $(tput sgr0)$(tput el) " PS4="$(tput setaf 7):; $(tput sgr0)" diff --git a/.config/ksh/prompt b/.config/ksh/prompt @@ -5,6 +5,12 @@ __prompt_col(){ printf '\[%s\]' "$(tput setaf $1)" } +__prompt_strip(){ + echo "$0" | grep -v ksh >/dev/null && { + sed 's/\\\[//g;s/\\\]//g' + } || cat +} + __ksh_prompt(){ errorcode=$1 # tput setaf 10 >/dev/null