dotfiles/config/shell/bashrc

43 lines
980 B
Bash

#!/usr/bin/env bash
#
# Bash aliases and customizations
#
# Shell options
shopt -s expand_aliases
shopt -s histappend
HISTCONTROL=ignoreboth:erasedups
# Prompt customization
INTERACTIVE_BASHPID_TIMER="${HOME}/.cache/bash_timer_$$"
PS0='$(echo $SECONDS > "$INTERACTIVE_BASHPID_TIMER")'
function _update_ps1() {
local __ERRCODE=$?
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
# echo -en "… $\r"
eval "$(powerline-go -shell bash -eval -duration $__DURATION -error $__ERRCODE "${POWERLINE_GO_DEFAULT_OPTS[@]}")"
}
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
# 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