Better bash prompt

This commit is contained in:
Maciej Jur 2023-07-25 13:57:30 +02:00
parent 04271572a1
commit e7c084c11d
No known key found for this signature in database
GPG key ID: ADA3BF323198C639

View file

@ -7,7 +7,24 @@
alias ls='ls --color=auto'
alias grep='grep --color=auto'
PS1='[\u@\h \W]\$ '
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
colorize() {
echo -e "\e[$1$2\e[m"
}
PS1='['
PS1+=$(colorize '92m' '\u')
PS1+='@'
PS1+=$(colorize '92m' '\h')
PS1+=':'
PS1+=$(colorize '94m' '\W')
PS1+=']'
PS1+=$(colorize '93m' '$(parse_git_branch)')
PS1+='\$ '
# Configure GPG
# This is needed to sign git commits
@ -16,6 +33,7 @@ export GPG_TTY=$(tty)
# Configure editor
export VISUAL="$(command -v nvim 2>/dev/null)"
export EDITOR="$(command -v nvim 2>/dev/null || command -v vim 2>/dev/null || command -v nano)"
alias vim='nvim'
# ghcup (Haskell)
[ -f "$HOME/.ghcup/env" ] && source "$HOME/.ghcup/env" # ghcup-env