install.fairie/dotfiles/.bashrc

73 lines
2.1 KiB
Bash
Raw Normal View History

2022-10-27 20:14:14 -07:00
#!/usr/bin/env bash
# shellcheck disable=SC1090,SC1091
# Prefer US English
export LANG="en_US"
2022-10-28 14:43:32 -07:00
### Fig / LC_ALL
2022-10-25 21:04:19 -07:00
if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ]; then
2022-10-28 14:43:32 -07:00
if [[ "$(hostname)" != *'-minimal' ]]; then
export LC_ALL="en_US.UTF-8"
fi
2022-10-25 21:04:19 -07:00
if [ -f "$HOME/.fig/shell/bashrc.pre.bash" ]; then
. "$HOME/.fig/shell/bashrc.pre.bash"
fi
fi
### ~/.profile
if [ -f "$HOME/.profile" ]; then
. "$HOME/.profile"
fi
### Settings
2022-10-27 20:14:14 -07:00
if command -v shopt >/dev/null; then
2022-09-30 06:52:29 -07:00
shopt -s globstar
shopt -s histappend
shopt -s checkwinsize
fi
### History
HISTCONTROL=ignoreboth
HISTSIZE=5000
HISTFILESIZE=5000
HISTFILE=~/.local/bash_history
2022-09-30 06:58:48 -07:00
# Prompt (on bash only)
if { [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ] || [ "$SHELL" = '/bin/bash' ]; } && [[ "$(hostname)" != *'-minimal' ]]; then
2022-09-30 06:58:48 -07:00
# Add new line before prompt
PROMPT_COMMAND="PROMPT_COMMAND=echo"
### Styled Terminal
2022-09-30 06:58:48 -07:00
case "$TERM" in
2022-10-27 20:14:14 -07:00
xterm* | rxvt* | Eterm | aterm | kterm | gnome* | alacritty)
PS1="\n \[\033[0;34m\]╭─\[\033[0;31m\]\[\033[0;37m\]\[\033[41m\] $OS_ICON \u \[\033[0m\]\[\033[0;31m\]\[\033[44m\]\[\033[0;34m\]\[\033[44m\]\[\033[0;30m\]\[\033[44m\] \w \[\033[0m\]\[\033[0;34m\] \n \[\033[0;34m\]╰ \[\033[1;36m\]\$ \[\033[0m\]"
;;
2022-09-30 06:58:48 -07:00
esac
### Directory Colors (https://github.com/trapd00r/LS_COLORS)
command -v gdircolors > /dev/null 2>&1 || gdircolors() { dircolors "$@"; }
if command -v gdircolors > /dev/null && [ -f "$HOME/.config/dircolors" ]; then
2022-10-27 20:14:14 -07:00
eval "$(gdircolors -b "$HOME/.config/dircolors")"
fi
2022-09-26 19:46:23 -07:00
fi
### Bash Completions
if [ "$0" = 'bash' ] || [ "$0" = '/bin/bash' ] || [ "$SHELL" = '/bin/bash' ]; then
### Google Cloud SDK
2022-10-27 20:14:14 -07:00
if command -v brew >/dev/null; then
if [ -f "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc" ]; then
. "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc"
fi
fi
### Java (asdf)
if [ -f "$HOME/.local/asdf/plugins/java/set-java-home.bash" ]; then
. "$HOME/.local/asdf/plugins/java/set-java-home.bash"
fi
2022-10-25 21:04:19 -07:00
### Fig
if [ -f "$HOME/.fig/shell/bashrc.post.bash" ]; then
. "$HOME/.fig/shell/bashrc.post.bash"
fi
fi