2019-04-14 19:41:33 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
#
|
|
|
|
# Bash aliases and customizations
|
|
|
|
#
|
|
|
|
|
|
|
|
# Shell options
|
|
|
|
|
|
|
|
shopt -s expand_aliases
|
|
|
|
shopt -s histappend
|
|
|
|
|
|
|
|
HISTCONTROL=ignoreboth:erasedups
|
|
|
|
|
|
|
|
# Prompt customization
|
|
|
|
|
2020-08-08 11:33:43 +02:00
|
|
|
if command -v powerline-go > /dev/null
|
|
|
|
then
|
|
|
|
INTERACTIVE_BASHPID_TIMER="${HOME}/.cache/bash_timer_$$"
|
2019-04-14 19:41:33 +02:00
|
|
|
|
2020-08-08 11:33:43 +02:00
|
|
|
PS0='$(echo $SECONDS > "$INTERACTIVE_BASHPID_TIMER")'
|
2019-04-14 19:41:33 +02:00
|
|
|
|
2020-08-08 11:33:43 +02:00
|
|
|
function _update_ps1() {
|
|
|
|
local __ERRCODE=$?
|
2019-04-14 19:41:33 +02:00
|
|
|
|
2020-08-08 11:33:43 +02:00
|
|
|
local __DURATION=0
|
|
|
|
if [ -e "$INTERACTIVE_BASHPID_TIMER" ]; then
|
|
|
|
local __END=$SECONDS
|
|
|
|
local __START=$(cat "$INTERACTIVE_BASHPID_TIMER")
|
|
|
|
__DURATION="$(($__END - ${__START:-__END}))"
|
|
|
|
\rm -f "$INTERACTIVE_BASHPID_TIMER"
|
|
|
|
fi
|
2019-04-14 19:41:33 +02:00
|
|
|
|
2020-10-17 23:47:48 +02:00
|
|
|
echo -en "\033]0; ${USER}@${HOSTNAME} $PWD\007"
|
2020-08-08 11:33:43 +02:00
|
|
|
# echo -en "… $\r"
|
|
|
|
eval "$(powerline-go -shell bash -eval -duration $__DURATION -error $__ERRCODE "${POWERLINE_GO_DEFAULT_OPTS[@]}")"
|
|
|
|
}
|
2019-04-14 19:41:33 +02:00
|
|
|
|
2020-08-08 11:33:43 +02:00
|
|
|
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
|
|
|
|
|
|
|
|
else
|
|
|
|
export PS1="\[\e]2;\u@\H \w\a\]\[\e[0;37m\][\[\e[0;${col}m\]\u\[\e[0;37m\]@\[\e[0;34m\]\h \[\e[0;36m\]\W\[\e[0;37m\]]\$\[\e[0m\] "
|
|
|
|
fi
|
2019-04-14 19:41:33 +02:00
|
|
|
|
|
|
|
# Completion
|
|
|
|
trysource /usr/share/bash-completion/bash_completion
|
|
|
|
|
|
|
|
# Fuzzy matching all the way
|
|
|
|
trysource /usr/share/fzf/completion.bash
|
|
|
|
trysource /usr/share/fzf/key-bindings.bash
|