bash_aliases: split up PS1 into multiple components

remove date/time from prompt
move git/svn status to second line
This commit is contained in:
Josh Holtrop 2018-06-18 21:03:20 -04:00
parent d3d9a98248
commit eec46ef9b2

View File

@ -111,11 +111,27 @@ function prompt_ps1_svn_branch()
fi
}
if [[ "${USER}" == "root" ]]; then
PS1="$(ps-color bold white on-red)\$(prompt_ps1_exit_status_1)$(ps-color reset)\$(prompt_ps1_exit_status_2)$(ps-color bold red)\u@\H$(ps-color bold green) \w$(ps-color bold magenta) \d \t$(ps-color bold blue)\$(prompt_ps1_job_count \\j)$(ps-color bold cyan)\$(prompt_ps1_shlvl)$(ps-color reset)\n\$ "
# exit status
PS1="$(ps-color bold white on-red)\$(prompt_ps1_exit_status_1)$(ps-color reset)\$(prompt_ps1_exit_status_2)"
# user name and host name
if [ "$USER" = "root" ]; then
PS1="${PS1}$(ps-color bold red)"
else
PS1="$(ps-color bold white on-red)\$(prompt_ps1_exit_status_1)$(ps-color reset)\$(prompt_ps1_exit_status_2)$(ps-color bold green)\u@\H$(ps-color bold cyan) \w$(ps-color bold magenta) \d \t$(ps-color bold blue)\$(prompt_ps1_job_count \\j)$(ps-color bold cyan)\$(prompt_ps1_shlvl)$(ps-color bold yellow)\$(prompt_ps1_git_branch)\$(prompt_ps1_svn_branch)$(ps-color reset)\n\$ "
PS1="${PS1}$(ps-color bold magenta)"
fi
PS1="${PS1}\u@\H"
# working directory
PS1="${PS1} $(ps-color bold cyan)\w"
# job count
PS1="${PS1}$(ps-color bold blue)\$(prompt_ps1_job_count \\j)"
# shell level
PS1="${PS1}$(ps-color bold green)\$(prompt_ps1_shlvl)"
# \n
PS1="${PS1}$(ps-color reset)\n"
# git/svn info
PS1="${PS1}$(ps-color bold yellow)\$(prompt_ps1_git_branch)\$(prompt_ps1_svn_branch)"
# dollar
PS1="${PS1}$(ps-color reset)\$ "
PROMPT_COMMAND="_last_exit_status=\$?"