-
Notifications
You must be signed in to change notification settings - Fork 1
/
bashrc
219 lines (191 loc) · 6.09 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
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
215
216
217
218
# vim: ft=bash ts=4 sw=3
# shellcheck disable=SC1090,SC1091
# To the extent possible under law, the author(s) have dedicated all
# copyright and related and neighboring rights to this software to the
# public domain worldwide. This software is distributed without any
# warranty.
# ~/.bashrc: executed by bash(1) for interactive shells.
# The copy in your home directory (~/.bashrc) is yours,
# please feel free to customise it to create a shell
# environment to your liking. If you feel a change
# would be benifitial to all, please feel free to send
# a patch to the dotfiles maintainers.
# User dependent .bashrc file
# If not running interactively, don't do anything
[[ "$-" != *i* ]] && return
# System interactive shell settings for bash
if [[ -f /etc/bashrc ]]; then
. /etc/bashrc
fi
if [[ -f /etc/bash.bashrc ]]; then
. /etc/bash.bashrc
fi
# Shell Options
#
# Make bash append rather than overwrite the history on disk
shopt -s histappend
# Completion Options
#
# These completion tuning parameters change the default behavior of
# bash_completion:
#
# Define to avoid stripping description in --option=description of
# './configure --help'
# COMP_CONFIGURE_HINTS=1
#
# Define to avoid flattening internal contents of tar files.
# COMP_TAR_INTERNAL_PATHS=1
#
# Bash Completion
#
# Enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bashrc and /etc/profile
# sources /etc/bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /usr/local/etc/bash_completion ]; then
. /usr/local/etc/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
if [[ "${OS}" == "cygwin" ]] || [[ "${OS}" == "Windows_NT" ]]; then
set completion-ignore-case on
fi
# History Options
#
# Ignore some controlling instructions.
#
# HISTIGNORE is a colon-delimited list of patterns which should be
# excluded. The '&' is a special pattern which suppresses duplicate
# entries.
#
# Exclude these commands from the history.
export HISTIGNORE=$'[ \t]*:&:[fb]g:exit:l[sla]'
#
# Don't put duplicate lines in the history.
export HISTCONTROL="${HISTCONTROL}${HISTCONTROL+,}ignoredups"
#
# Append to the history file, don't overwrite it.
shopt -s histappend
#
# Set the History length.
export HISTSIZE=1000
export HISTFILESIZE=2000
# Path Options
#
# Set PATH so it includes local system admin programs.
if [[ -d /usr/local/sbin ]]; then
export PATH="/usr/local/sbin:${PATH}"
fi
# Set PATH so it includes user's private bin if it exists.
if [[ -d "${HOME}/.local/bin" ]]; then
export PATH="${HOME}/.local/bin:${PATH}"
fi
# Set MANPATH so it includes users' private man if it exists.
if [[ -d "${HOME}/.local/man" ]]; then
export MANPATH="${HOME}/.local/man:${MANPATH}"
fi
# Set INFOPATH so it includes users' private info if it exists.
if [[ -d "${HOME}/.local/info" ]]; then
export INFOPATH="${HOME}/.local/info:${INFOPATH}"
fi
# Set CDPATH so it includes users' home folder.
#
# Look in the current path then users' home path when changing
# directory.
[[ -n "${CDPATH}" ]] || CDPATH='.';
[[ -d "${HOME}" ]] && CDPATH="${CDPATH}:${HOME}";
# Look in the projects code path when changing directory.
#[[ -d /opt/projects ]] && CDPATH="$CDPATH:/opt/projects";
export CDPATH;
# Editor Options
#
# Set the default text editor to use with various
# programs and commands.
export EDITOR='vim';
export VISUAL="$EDITOR";
# less
#
# Make less more friendly for non-text input files, see lesspipe(1).
[[ -x /usr/bin/lesspipe ]] && eval "$(SHELL=/bin/sh lesspipe)"
# Aliases
#
# Some people use a different file for aliases.
if [[ -f "${HOME}/.bash_aliases" ]]; then
. "${HOME}/.bash_aliases"
fi
# Functions
#
# Some people use a different file for functions.
if [[ -f "${HOME}/.bash_functions" ]]; then
. "${HOME}/.bash_functions"
fi
# Command-line Prompt
#
# Pluggable command-line prompt.
for i in "${HOME}"/.bash_prompt*; do
if [[ -r "$i" ]] && [[ "$i" != *.orig~ ]]; then
. "$i"
fi
done
unset i
#
# Configure Git prompt settings.
# Allowed values described in `bash_prompt_git'.
export GIT_PS1_SHOWCOLORHINTS='';
export GIT_PS1_SHOWDIRTYSTATE='auto';
export GIT_PS1_SHOWSTASHSTATE='auto'
export GIT_PS1_SHOWUNTRACKEDFILES='';
#export GIT_PS1_SHOWUPSTREAM='verbose name';
export GIT_PS1_SHOWUPSTREAM='verbose';
export GIT_PS1_DESCRIBE_STYLE='branch';
# Apple
#
# On macOS tell ssh-add to use the keychain.
export APPLE_SSH_ADD_BEHAVIOR=macos
# Add nvm (Node Version Manager) support.
export NVM_DIR="${HOME}/.nvm"
export NVM_SYMLINK_CURRENT=true
[[ -s "$NVM_DIR/nvm.sh" ]] && \. "$NVM_DIR/nvm.sh"
[[ -s "$NVM_DIR/bash_completion" ]] && \. "$NVM_DIR/bash_completion"
# Homebrew unversioned Python.
if [[ -d "$(brew --prefix 2>/dev/null)/opt/python/libexec/bin" ]]; then
export PATH="$(brew --prefix 2>/dev/null)/opt/python/libexec/bin:${PATH}"
fi
# Python Pipenv.
# if command -v python 1>/dev/null && [[ -d "$(python -m site --user-base 2>/dev/null)"/bin ]]; then
# export PATH="$(python -m site --user-base)/bin:${PATH}"
# fi
# Python pyenv.
if command -v pyenv 1>/dev/null; then
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
fi
# Add Ruby Version Manager binaries to PATH.
if [[ -d "${HOME}/.rvm/bin" ]]; then
export PATH="${PATH}:${HOME}/.rvm/bin"
[[ -d "${HOME}/.rvm/scripts/rvm" ]] && \. "${HOME}/.rvm/scripts/rvm"
fi
# Add Ruby Environment switcher support.
export RBENV_ROOT="${HOME}/.rbenv"
if [[ -d "${RBENV_ROOT}" ]]; then
eval "$(rbenv init -)"
fi
# Add PHP Environment switcher support.
export PHPENV_ROOT="${HOME}/.phpenv"
if [[ -d "${PHPENV_ROOT}" ]]; then
export PATH="${PHPENV_ROOT}/bin:${PATH}"
eval "$(phpenv init -)"
fi
# Add Composer global vendor binaries to PATH.
if [[ -d "$(composer global config bin-dir --absolute 2>/dev/null)" ]]; then
PATH="${PATH}:$(composer global config bin-dir --absolute 2>/dev/null)"
export PATH
fi
# Initialise symfony-autocomplete command completion.
if command -v symfony-autocomplete 1>/dev/null; then
eval "$(symfony-autocomplete)"
fi