mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 15:34:40 +01:00
46 lines
834 B
Text
46 lines
834 B
Text
source "$DOTFILES_SHELL_DIR/prompt_segments"
|
|
source "$DOTFILES_BASH_DIR/prompt_segments"
|
|
source "$DOTFILES_SHELL_DIR/prompt_vcs"
|
|
|
|
prompt_host() {
|
|
local host_bg='black'
|
|
local host_fg='white'
|
|
|
|
if [[ $UID -eq 0 ]]; then
|
|
host_bg='red'
|
|
fi
|
|
|
|
if [[ -n $SSH_CLIENT ]]; then
|
|
host_fg='yellow'
|
|
fi
|
|
|
|
prompt_segment $host_bg $host_fg '\u@\h'
|
|
}
|
|
|
|
prompt_dir() {
|
|
prompt_segment green white '\w'
|
|
}
|
|
|
|
prompt_build() {
|
|
prompt_setup_segments
|
|
CURRENT_BG='NONE'
|
|
prompt_host
|
|
if prompt_vcs_repo; then
|
|
prompt_vcs_status
|
|
prompt_vcs_action
|
|
else
|
|
prompt_dir
|
|
fi
|
|
prompt_last_rc
|
|
prompt_end
|
|
echo -n ' '
|
|
}
|
|
|
|
prompt_last_rc() {
|
|
[[ $LAST_CMD_RC -ne 0 ]] && prompt_segment red white "$LAST_CMD_RC"
|
|
}
|
|
|
|
set_prompt() {
|
|
__git_ps1_vars
|
|
PS1="$(prompt_build)"
|
|
}
|