From a7305f5bf96ece88496ec6b4746d0aae92293ee2 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Thu, 16 Aug 2018 18:59:04 -0400 Subject: Apply realpath to HOME This fixes the prompt for FreeBSD's /home shenanigans. This is the one thing that just seems dirty to me in FreeBSD. Why. --- home/.kshrc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'home') diff --git a/home/.kshrc b/home/.kshrc index 11585e50..972bace9 100644 --- a/home/.kshrc +++ b/home/.kshrc @@ -6,7 +6,7 @@ function colonize { IFS=: print "$*" } -system_path=$PATH +systemPath=$PATH PATH=$(colonize {,/usr{/local,/pkg,},$HOME/.local}/{s,}bin /usr/games) CDPATH=:$HOME @@ -60,22 +60,24 @@ function branch { fi } +type realpath > /dev/null && HOME=$(realpath "$HOME") function prompt { - typeset status=$? title left right path color cols + typeset status=$? + typeset path title right color left cols [[ ${PWD#$HOME} != $PWD ]] && path="~${PWD#$HOME}" || path=$PWD title=${path##*/} - right="$path$(branch)" + right="${path}$(branch)" [[ -n ${SSH_CLIENT:-} ]] && color=${fg[5]} || color=${fg[7]} (( status )) && color=${fg[1]} - left="\01$color\01\$\01$fg\01 " + left="\01${color}\01\$\01${fg}\01 " - [[ $TERM = xterm* ]] && title="\033]0;$title\07" || title='' + [[ $TERM = xterm* ]] && title="\033]0;${title}\07" || title='' [[ -n ${COLUMNS:-} ]] && cols=$COLUMNS || cols=$(tput cols) typeset -R $(( cols / 2 )) right typeset -R $(( cols - 1 )) right - print "\01\r\01$title\01\n\01${fg[7]}$right$fg\r\01$left" + print "\01\r\01${title}\01\n\01${fg[7]}${right}${fg}\r\01${left}" } PS1='$(prompt)' -- cgit 1.4.1