-
Notifications
You must be signed in to change notification settings - Fork 2
/
.tools_bashrc
214 lines (162 loc) · 5.68 KB
/
.tools_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
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# ~/.bashrc: executed by bash(1) for non-login shells.
if [ -f ~/.pathrc ]; then
source ~/.pathrc
fi
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
if [ -f ~/.auth_sockrc ]; then
source ~/.auth_sockrc
fi
# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
export HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# Timestamps in `history' output
export HISTTIMEFORMAT="%s "
unset HISTFILESIZE
export HISTFILESIZE
unset HISTSIZE
export HISTSIZE
# 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
# Alias definitions.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# Function definitions.
if [ -f ~/.bash_functions ]; then
. ~/.bash_functions
fi
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
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='fgrep --color=auto'
#alias egrep='egrep --color=auto'
fi
# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
HASCOMPLETION=0
if ! shopt -oq posix; then
if [ -f ~/.tools/localized/bash-completion/bash_completion ]; then
source ~/.tools/localized/bash-completion/bash_completion
HASCOMPLETION=1
elif [ -f /etc/bash_completion ]; then
source /etc/bash_completion
HASCOMPLETION=1
elif [ -f /opt/local/etc/bash_completion ]; then
# MacPorts Bash shell command completion
source /opt/local/etc/bash_completion
HASCOMPLETION=1
elif type brew >/dev/null 2>&1 && [[ -f $(brew --prefix)/etc/bash_completion ]]; then
# Homebrew Bash shell command completion
source $(brew --prefix)/etc/bash_completion
HASCOMPLETION=1
elif type _get_comp_words_by_ref >/dev/null 2>&1; then
HASCOMPLETION=1
fi
if [ $HASCOMPLETION == 1 ]; then
for path in ~/.bash_completions/* ; do
if [ -f "$path" ]; then
source "$path"
fi
done
unset HASCOMPLETION
fi
fi
ANSII_RESET="\[\033[0m\]"
ANSII_YELLOW="\[\033[33m\]"
ANSII_RED="\[\033[31m\]"
# Git PS1 support
GIT_PROMPT_LOCATION=/run/current-system/sw/share/bash-completion/completions/git-prompt.sh
if ! type __git_ps1 >/dev/null 2>&1 && [ -f "$GIT_PROMPT_LOCATION" ]; then
source "$GIT_PROMPT_LOCATION"
fi
GITPS1=''
NIXPS1=''
if [[ $(__git_ps1 1>/dev/null 2>/dev/null) || $? == 0 ]]; then
GITPS1="\$(__git_ps1 \" $ANSII_RED(%s)$ANSII_RESET\")"
fi
if [ -n "$IN_NIX_SHELL" ]; then
NIXPS1=" $ANSII_YELLOW(nix)$ANSII_RESET"
fi
PS1="$ANSII_RESET\h:\W$NIXPS1$GITPS1 \u\$ $ANSII_RESET"
unset ANSII_RESET ANSII_RED
export LESS='-RFMSXix4'
if [ -f /usr/share/source-highlight/src-hilite-lesspipe.sh ]; then
export LESSOPEN="| /usr/share/source-highlight/src-hilite-lesspipe.sh %s"
fi
HISTNAME=$(hostname -s).hist
if [ -f ~/.bash_history ]; then
TEMPNAME=$HISTNAME-$(date +%s)
if [ ! -e $TEMPNAME ]; then
mv ~/.bash_history ~/$TEMPNAME
mkdir ~/.bash_history
mv -i $TEMPNAME ~/.bash_history/$HISTNAME
fi
fi
if [ "$HISTFILE" = ~/.bash_history ]; then
export HISTFILE=$HOME/.bash_history/$HISTNAME
unset HISTNAME
fi
# Disable flow control
stty -ixon
# Disable history expansion
set +H
# Fix pintry-curses on CentOS, as per http://forums.gentoo.org/viewtopic-t-699598.html
# > Turns out pinentry needs to know the TTY it should use. Apparently it's
# > able to deduce this when it's run from the command line, but the pine
# > ncurses interface confuses it.
# >
# > I added the following line (which came from the gpg-agent man page) to
# > my ~/.bash_profile at the bottom and it works now:
# GPG always wants to know what TTY it's running on.
export GPG_TTY=$(tty)
if type nvim >/dev/null 2>&1; then
export EDITOR=nvim
elif type vim >/dev/null 2>&1; then
export EDITOR=vim
fi
# Nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
# pyenv
if hash pyenv 2>/dev/null; then
eval "$(pyenv init -)"
fi
export PYTHONSTARTUP="$HOME/.pythonrc"
## Until Wayland is set up better
## https://wayland.freedesktop.org/building.html
#export XDG_RUNTIME_DIR="/tmp/${UID}-runtime-dir"
# Set up chruby
if [ -f "/usr/local/opt/chruby/share/chruby/chruby.sh" ]; then
source /usr/local/opt/chruby/share/chruby/chruby.sh
fi
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
[ -e "$HOME/.env" ] && source "$HOME/.env"
if [ -f ~/.tools/configs-private/machines/$(hostname -s).bashrc ]; then
. ~/.tools/configs-private/machines/$(hostname -s).bashrc
fi
if [ -f ~/.tools/configs/machines/$(hostname -s).bashrc ]; then
. ~/.tools/configs/machines/$(hostname -s).bashrc
fi
export PATH=/Users/dstewart/.local/share/fury/usr/active/bin:/Users/dstewart/.local/share/fury/usr/active/opt:$PATH # Added by Fury