-
Notifications
You must be signed in to change notification settings - Fork 1
/
bashrc
33 lines (28 loc) · 1.03 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
# source readable files
function check_and_source {
if [ -r $1 ]; then source $1; fi
}
check_and_source /usr/local/lib/initfiles/system-bashrc
check_and_source ~/.bash_aliases
check_and_source ~/.bash_completion
check_and_source ~/.bash_exports
check_and_source ~/.bash_functions
check_and_source ~/.bash_palette
function ps2_prompt {
local indent=$((15+${#USER}+${#SHORTHOST}))
if [[ ${PWD} == ${HOME}* ]]; then
((indent+=$((${#PWD}-${#HOME}+1))))
else
((indent+=${#PWD}))
fi
PS2="$(printf ' %.0s' $(eval echo {1..${indent}}))> "
}
# pre-prompt executions - tab name short-hostname:pwd
PROMPT_COMMAND='echo -ne "$E_ESC$SHORTHOST:$(pwd)$E_BEL";'
PROMPT_COMMAND+='ps2_prompt;'
# [time] [email protected]: pwd $ as the primary prompt
PS1="$C_RED[\t] $C_BROWN\u$C_CYAN@$C_BROWN$SHORTHOST$C_CYAN:$C_BLUE \w $C_RED\$$C_OFF "
# shell options
shopt -s cdspell checkwinsize cmdhist histappend no_empty_cmd_completion
if [ ${BASH_VERSINFO} -ge 4 ]; then shopt -s autocd checkjobs dirspell; fi
if [[ ${BASH_VERSION} =~ "4.2" ]]; then shopt -s direxpand; fi