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
commita7305f5bf96ece88496ec6b4746d0aae92293ee2 (patch)
tree40a3c76cdb88d3f37d127c8788acb1a4aa507e8a /home
parentInstall mksh rather than zsh (diff)
downloadsrc-a7305f5bf96ece88496ec6b4746d0aae92293ee2.tar.gz
src-a7305f5bf96ece88496ec6b4746d0aae92293ee2.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 'home')
-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)'