Repository navigation
Expand file tree
/
Copy pathdot_bashrc
More file actions
executable file
·67 lines (58 loc) · 2.05 KB
/
Copy pathdot_bashrc
File metadata and controls
executable file
·67 lines (58 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
##=========================================
## .bashrc
##=========================================
# If not running interactively, don't do anything.
[ -z "$PS1" ] && return
## Path Helpers
if [ -f "$HOME/.config/shell/path.bash" ]; then
source "$HOME/.config/shell/path.bash"
fi
## History (shared across sessions, deduped; mirrors .zshrc)
HISTSIZE=10000
HISTFILESIZE=$HISTSIZE
HISTFILE="$HOME/.bash_history"
HISTCONTROL=ignoredups:erasedups
shopt -s histappend
# Starship moves the existing PROMPT_COMMAND into STARSHIP_PROMPT_COMMAND, so
# check both to keep re-sourcing this file idempotent.
case ";${PROMPT_COMMAND:-};${STARSHIP_PROMPT_COMMAND:-};" in
*"history -a; history -n"*) ;;
*) PROMPT_COMMAND="history -a; history -n${PROMPT_COMMAND:+; $PROMPT_COMMAND}" ;;
esac
## Options
shopt -s checkwinsize # zsh does this automatically
shopt -s globstar # ** recursive globs, as in zsh
set -o ignoreeof
## Line Editing (vi mode, as in .zshrc)
set -o vi
## Bash Completion
if command -v brew &>/dev/null; then
if [[ -f "$(brew --prefix)/etc/profile.d/bash_completion.sh" ]]; then
source "$(brew --prefix)/etc/profile.d/bash_completion.sh"
fi
elif [[ -f /usr/share/bash-completion/bash_completion ]]; then
source /usr/share/bash-completion/bash_completion
elif [[ -f /etc/bash_completion ]]; then
source /etc/bash_completion
fi
## Shared Interactive Config
if [ -f "$HOME/.config/shell/interactive.sh" ]; then
source "$HOME/.config/shell/interactive.sh"
fi
## Starship
if command -v starship &>/dev/null; then
# Clear stale line state before each prompt render. Starship defines its own
# starship_precmd, so this hook needs a distinct name.
__sanitize_prompt() { printf '\r\033[K'; }
case ";${PROMPT_COMMAND:-};${STARSHIP_PROMPT_COMMAND:-};" in
*__sanitize_prompt*) ;;
*) PROMPT_COMMAND="__sanitize_prompt${PROMPT_COMMAND:+; $PROMPT_COMMAND}" ;;
esac
if ! declare -F starship_precmd >/dev/null; then
eval "$(starship init bash)"
fi
fi
## Apply Base Path Order
if declare -F _bash_apply_base_path_order >/dev/null; then
_bash_apply_base_path_order
fi