summary refs log tree commit diff
path: root/home
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-16 18:59:04 -0400
committerJune McEnroe <june@causal.agency>2018-08-16 18:59:04 -0400
commite6cbe3077a0900294a73ba75cec71839697afd1c (patch)
treeed9c3cba995b8565a5b5f1cd3086ae757ca539a3 /home
parentInstall mksh rather than zsh (diff)
downloadsrc-e6cbe3077a0900294a73ba75cec71839697afd1c.tar.gz
src-e6cbe3077a0900294a73ba75cec71839697afd1c.zip
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.
Diffstat (limited to '')
-rw-r--r--home/.kshrc14
1 files changed, 8 insertions, 6 deletions
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)'