Repository navigation
Expand file tree
/
Copy path.bashrc
More file actions
175 lines (143 loc) · 4.58 KB
/
Copy path.bashrc
File metadata and controls
175 lines (143 loc) · 4.58 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
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
if [ -z "$PS1" ]; then
return
fi
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
case "$TERM" in
xterm-color)
color_prompt=yes
;;
*)
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
;;
esac
# 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
#TODO: set this on load
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='grep -F --color=auto'
alias egrep='grep -E --color=auto'
fi
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
source /etc/bash_completion
fi
setup_bashrc_local_before() {
if [ -e "${HOME}/.bashrc.local.before" ]; then
source "${HOME}/.bashrc.local.before"
fi
}
#
setup_dotfiles() {
### setup_dotfiles()
# There should be a symlink from ~/-dotfiles to the dotfiles dir
# ln -s ${WORKON_HOME}/dotfiles/src/dotfiles ~/-dotfiles
__DOTFILES=${__DOTFILES:-"${HOME}/-dotfiles"}
if [ -n "${__DOTFILES}" ] && [ -d "${__DOTFILES}" ]; then
export __DOTFILES
_dotfiles_bashrc="${__DOTFILES}/etc/bash/00-bashrc.before.sh"
if [[ -f "${_dotfiles_bashrc}" ]]; then
# shellcheck source=etc/bash/00-bashrc.before.sh
source "${_dotfiles_bashrc}"
else
echo "ERROR: _dotfiles_bashrc: ${_dotfiles_bashrc}"
fi
fi
if [ -e "${HOME}/.bashrc.local.after" ]; then
source "${HOME}/.bashrc.local.after"
fi
}
setup_conda() {
### setup_conda() -- setup conda with prefix $CONDA_ROOT
export CONDA_ROOT=$CONDA_ROOT
if [ -z "${CONDA_ROOT}" ]; then
echo "Notice: conda is not loading because CONDA_ROOT was not set."
return
fi
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$("${CONDA_ROOT}/bin/conda" 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "${CONDA_ROOT}/etc/profile.d/conda.sh" ]; then
. "${CONDA_ROOT}/etc/profile.d/conda.sh"
else
export PATH="${CONDA_ROOT}/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
}
setup_bun() {
### setup_bun() -- export PATH=+${BUN_INSTALL}/bin
BUN_INSTALL=${BUN_INSTALL:-"$HOME/.bun"}
if [ -d "${BUN_INSTALL}/bin" ]; then
export BUN_INSTALL
export PATH="$BUN_INSTALL/bin:$PATH"
fi
}
setup_aftman() {
### setup_aftman() -- source $AFTMAN_ENV
AFTMAN_ENV=${AFTMAN_ENV:-"${HOME}/.aftman/env"}
if [ -f "${AFTMAN_ENV}" ]; then
export AFTMAN_ENV
. "${AFTMAN_ENV}"
# . "${HOME}/.aftman/env"
fi
}
setup_cargo() {
### setup_cargo() -- source $CARGO_ENV
CARGO_ENV=${CARGO_ENV:-"${HOME}/.cargo/env"}
if [ -f "${CARGO_ENV}" ]; then
export CARGO_ENV
. "${CARGO_ENV}"
# . "${HOME}/.cargo/env"
fi
}
setup_bashrc_package_managers() {
test -n "${CONDA_ROOT}" && setup_conda
setup_cargo
setup_aftman
setup_bun
}
setup_bashrc_local_before
setup_dotfiles
setup_bashrc_package_managers