logo

dotfiles

My dotfiles, one branch per machine
commit: 8520b6a4ab3537a921c9dfc225d3386e20c1e396
parent: b43a884e15bb3118b567449ef7364e447cb84585
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon, 23 Dec 2019 17:45:03 +0100

.profile: git-branch to mksh-only, add $? & date to PS1

Diffstat:

M.profile10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/.profile b/.profile @@ -107,9 +107,9 @@ get_git_branch() { branch='@.' fi - printf -- ' %s' "$branch" + printf -- ' %s' "$branch" else - echo '' + echo '' fi } @@ -128,14 +128,14 @@ esac case $SHELL in *ksh*) # hack derived from ksh88(1), works in mksh, doesn't works in bash - export PS1=' ${USER}[${host_ansi}m@$(hostname)$(get_working_directory)$(get_git_branch) ' + export PS1=' $?$(date +w%wT%T)${USER}[${host_ansi}m@$(hostname)$(get_working_directory)$(get_git_branch) ' ;; *bash*) - export PS1='\[\e[40;32m\]\u\[\e[${host_ansi}m\]@\h\]\[\e[30;46m\]$(get_working_directory)$(get_git_branch)\[\e[0m\] ' + export PS1='\[\e[47;30m\]$?\[\e[37;100m\]\[\e[100;30m\]$(date +w%wT%T)\[\e[40;90m\]\[\e[40;32m\]\u\[\e[${host_ansi}m\]@\h\]\[\e[30;46m\]$(get_working_directory)\[\e[0;36m\]\[\e[0m\] ' ;; *) # Don't even try escape codes, and so no powerline-style - export PS1='$USER${HOSTNAME:=$(hostname)} $(get_working_directory) $(get_git_branch) > ' + export PS1='$? $(date +w%wT%T) $USER@${HOSTNAME:=$(hostname)} $(get_working_directory) $(get_git_branch) > ' ;; esac