-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_profile_interactive_last
103 lines (80 loc) · 3.47 KB
/
.bash_profile_interactive_last
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
#= Homebrew/bash-completion =================================================
if [[ -r ${brew_prefix}/etc/profile.d/bash_completion.sh ]]; then
. ${brew_prefix}/etc/profile.d/bash_completion.sh
fi
#= AWS Bash Completion ======================================================
complete -C "${HOME}/.pyenv/shims/aws_completer" aws
#= Terminal colours (after installing GNU coreutils) ========================
NM="\[\033[0;38m\]" #means no background and white lines
HI="\[\033[0;37m\]" #change this for letter colors
HII="\[\033[0;32m\]" #change this for letter colors
SI="\[\033[0;33m\]" #this is for the current directory
IN="\[\033[0m\]"
PS1="$NM[$HI\u@$HII\h $SI\w$NM]\\\$$IN " && export PS1
if [[ "${TERM}" != "dumb" ]]; then
LS_OPTIONS='--color=auto' && export LS_OPTIONS
GREP_OPTIONS='--color=auto' && export GREP_COLORS
CLICOLOR=1 && export CLICOLOR
# Set colors for less. Borrowed from https://wiki.archlinux.org/index.php/Color_output_in_console#less .
export LESS_TERMCAP_mb=$'\E[1;31m' # begin bold
export LESS_TERMCAP_md=$'\E[1;36m' # begin blink
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;44;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
eval `dircolors ~/.dir_colors`
fi
#= make history store more commands (1000000 bytes) =========================
HISTSIZE=1000000 && export HISTSIZE
HISTFILESIZE=1000000 && export HISTFILESIZE
HISTTIMEFORMAT='%F %T ' && export HISTTIMEFORMAT
if [[ ! -d ${HOME}/.history ]]; then
if [[ -e ${HOME}/.history ]]; then
mv ${HOME}/.history ${HOME}/.history.bak
fi
mkdir ${HOME}/.history
chmod 777 ${HOME}/.history
fi
HISTFILE="${HOME}/.history/$(whoami)" && export HISTFILE
#= unify bash history across session exits, and update in realtime ==========
shopt -s histappend
if [[ ! ${PROMPT_COMMAND} =~ 'history -a; history -c; history -r;' ]]; then
PROMPT_COMMAND="history -a; history -c; history -r; ${PROMPT_COMMAND}" && export PROMPT_COMMAND
fi
#= store multi-line commands in history =====================================
shopt -s cmdhist
#= verify history before executing ==========================================
shopt -s histverify
#= customize what goes into history =========================================
HISTCONTROL=ignoredups:ignorespace && export HISTCONTROL
HISTIGNORE="ls:ll:la:ls.:l.:man:[bf]g:history:history *:h:h *:clear:c:exit:e" && export HISTIGNORE
#= z.lua ("cd" jump history) ================================================
if [[ -f /usr/share/z.lua/z.lua ]]; then
export _ZL_ECHO=1
export _ZL_CMD="zz"
eval "$(lua /usr/share/z.lua/z.lua --init bash enhanced once fzf)"
function z() {
if [[ "$argv[1]" == "-"* ]]; then
_zlua "$@"
else
cd "$@" 2> /dev/null || _zlua "$@"
fi
}
fi
#= Prompt ===================================================================
if [[ -f ~/.bash_prompt ]]; then
source ~/.bash_prompt
fi
#= cd to symlinked ~ ========================================================
if [[ $(pwd) =~ "${HOME}(\$|\/)(.*)" ]]; then
cd ~/"${BASH_REMATCH[2]}"
fi
#= Start TMUX on Login ======================================================
if [[ -z ${TMUX} ]] && hash tmux 2>/dev/null; then
tm $(date +%Y%m%d%H%M%S)
fi
#= output w & nproc =========================================================
if [[ $- == *i* ]]; then
w
fi