-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashrc
More file actions
106 lines (85 loc) · 2.31 KB
/
bashrc
File metadata and controls
106 lines (85 loc) · 2.31 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
# ~/.bashrc: executed by bash(1) for non-login shells.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
if [ -f /etc/bashrc ]; then
source /etc/bashrc
fi
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
if [ -n $XDG_CONFIG_HOME ]; then
export XDG_CONFIG_HOME="$HOME/.config"
fi
if [ -n $XDG_DATA_HOME ]; then
export XDG_DATA_HOME="$HOME/.local/share"
fi
# path
if [ -d $HOME/go/bin ]; then
export PATH="$HOME/go/bin:$PATH"
fi
if [ -d /snap/bin ]; then
export PATH="/snap/bin:$PATH"
fi
py3_user_bin=$(python3 -m site --user-base)
if [ -d $py3_user_bin/bin ]; then
export PATH="$py3_user_bin/bin:$PATH"
fi
if [ -d $HOME/bin ]; then
export PATH="$HOME/bin:$PATH"
fi
# shell options
shopt -s histappend
shopt -s checkwinsize
shopt -s cdspell
shopt -s extglob
# history
HISTCONTROL=ignoredups:ignorespace:ignoreboth
HISTSIZE=50000
HISTFILESIZE=50000
# editor
if [ -n $(which nvim) ]; then
export EDITOR=nvim
elif [ -n $(which vim) ]; then
export EDITOR=vim
else
export EDITOR=vi
fi
brewdir=''
which brew > /dev/null 2>&1
if [ $? == 0 ]; then
brewdir=$(brew --prefix)
fi
bash_completion="${brewdir}/etc/bash_completion"
# enable programmable completion features
if [ -f $bash_completion ] && ! shopt -oq posix; then
# shellcheck disable=SC1091
source $bash_completion
fi
# bash-git-prompt: https://github.com/magicmonty/bash-git-prompt
# mac / homebrew
if [ -f "${brewdir}/opt/bash-git-prompt/share/gitprompt.sh" ]; then
__GIT_PROMPT_DIR="${brewdir}/opt/bash-git-prompt/share"
# shellcheck source=/dev/null
source "${brewdir}/opt/bash-git-prompt/share/gitprompt.sh"
export GIT_PROMPT_THEME=Solarized
fi
# linux / git clone
if [ -f "${XDG_DATA_HOME}/bash-git-prompt/gitprompt.sh" ]; then
GIT_PROMPT_ONLY_IN_REPO=1
source "${XDG_DATA_HOME}/bash-git-prompt/gitprompt.sh"
export GIT_PROMPT_THEME=Solarized
fi
# terminal title
case "$TERM" in
xterm*|rxvt*|tmux*)
export PS1="\[\e]0;\u@\h: \w\a\]$PS1"
;;
screen*)
export PS1="\[\033[00;32m\]\h:\[\033[01;34m\]\W \[\033[31m\]\[\033[00m\]$\[\033[00m\] "
;;
*)
;;
esac
[ -f ~/.aliases ] && source ~/.aliases
[ -r "${HOME}/.byobu/prompt" ] && . "${HOME}/.byobu/prompt" #byobu-prompt#
[ -f ~/.fzf.bash ] && source ~/.fzf.bash