-
Notifications
You must be signed in to change notification settings - Fork 1
/
.bashrc
146 lines (119 loc) · 3.94 KB
/
.bashrc
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=1000
HISTFILESIZE=2000
shopt -s checkwinsize
shopt -s globstar 2> /dev/null || :
set -o vi
# Make less more friendly for non-text input files, see lesspipe(1)
if [ -x '/usr/bin/lesspipe' ]; then
eval "$(SHELL=/bin/sh lesspipe)"
fi
if [ -z "${debian_chroot:-}" ] && [ -r '/etc/debian_chroot' ]; then
debian_chroot="$(cat /etc/debian_chroot)"
fi
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# __git_ps1 may already be sourced from e.g. /etc/bash_completion.d/git-prompt
# on Ubuntu (which in turn sources /usr/lib/git-core/git-sh-prompt); if not, it
# can be sourced via Git's source code (e.g. via download or sparse checkout) at
# <https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh> and
# placed into /etc/bash_completion.d/ or ~/.local/etc/bash_completion.d/, for
# example.
if ! command -v __git_ps1 > /dev/null 2>&1; then
__git_ps1() {
:
}
fi
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWUPSTREAM=auto
GIT_PS1_STATESEPARATOR=
GIT_PS1_COMPRESSSPARSESTATE=true
GIT_PS1_SHOWCONFLICTSTATE=yes
if [ "$color_prompt" = yes ]; then
# https://misc.flogisoft.com/bash/tip_colors_and_formatting
if [ -n "$POWERLINE" ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[1;97;$([ "$(id -u)" = 0 ] && echo 41 || echo 45)m\]\u@\h\[\033[21;24;$([ "$(id -u)" = 0 ] && echo 31 || echo 35);44m\]\[\033[1;97m\]\w\[\033[34m\]$(__git_ps1 "\[\033[21;24;34;42m\]\[\033[1;97m\]%s\[\033[32m\]")\[\033[49m\]\[\033[0m\]'
else
PS1='${debian_chroot:+($debian_chroot)}\[\033[1;$([ "$(id -u)" = 0 ] && echo 31 || echo 35)m\]\u@\h\[\033[0m\]:\[\033[1;34m\]\w\[\033[0m\]$(__git_ps1 "@\[\033[1;32m\]%s\[\033[0m\]")\[\033[35m\]\$\[\033[0m\] '
fi
# For macOS
export CLICOLOR=true
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1 "@%s")\$ '
fi
unset color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
PROMPT_COMMAND='echo -en "\033]0;$(whoami)@$(hostname -s):$(dirs -0)$(__git_ps1 "@%s")\a"'
if command -v dircolors > /dev/null 2>&1; then
if [ -r "$HOME/.dircolors" ]; then
eval "$(dircolors -b "$HOME/.dircolors")" || eval "$(dircolors -b)"
fi
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
fi
echo -n | grep --color '' > /dev/null 2>&1
if [ $? -le 1 ]; then
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
if diff --color=auto /dev/null /dev/null > /dev/null 2>&1; then
alias diff='diff --color=auto'
fi
if [ -f "$HOME/.bash_aliases" ]; then
. "$HOME/.bash_aliases"
fi
if ! shopt -oq posix; then
if [ -f "$PREFIX/usr/share/bash-completion/bash_completion" ]; then
. "$PREFIX/usr/share/bash-completion/bash_completion"
fi
if [ -f "$PREFIX/etc/bash_completion" ]; then
. "$PREFIX/etc/bash_completion"
fi
if [ -f "$PREFIX/usr/local/etc/bash_completion" ]; then
. "$PREFIX/usr/local/etc/bash_completion"
fi
if [ -f "$HOME/.local/etc/bash_completion" ]; then
. "$HOME/.local/etc/bash_completion"
fi
# https://docs.brew.sh/Shell-Completion#configuring-completions-in-bash
if command -v brew &>/dev/null 2>&1; then
if [[ -r "$(brew --prefix)/etc/profile.d/bash_completion.sh" ]]; then
source "$(brew --prefix)/etc/profile.d/bash_completion.sh"
fi
for completion in "$(brew --prefix)/etc/bash_completion.d/"*; do
if [ -r "$completion" ]; then
. "$completion"
fi
done
fi
if [ -n "$NVM_DIR" ] && [ -f "$NVM_DIR/bash_completion" ]; then
. "$NVM_DIR/bash_completion"
fi
if command -v doctl > /dev/null 2>&1; then
source <(doctl completion bash)
fi
fi
if command -v pyenv > /dev/null 2>&1; then
eval "$(pyenv init -)"
fi
if [ -f "$HOME/.bashrc.local" ]; then
. "$HOME/.bashrc.local"
fi