-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbashrc
143 lines (117 loc) · 3.82 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
# shellcheck shell=bash disable=SC1090
# shellcheck source=shrc
[ -r "$HOME/.shrc" ] && . "$HOME/.shrc"
[ -z "$PS1" ] && return
shopt -s cdspell
shopt -s checkhash
shopt -s checkjobs 2>/dev/null
shopt -s direxpand 2>/dev/null && shopt -s dirspell
shopt -s dotglob
shopt -s extglob
shopt -s globstar 2>/dev/null
shopt -s histappend
shopt -s no_empty_cmd_completion
unset MAILCHECK
HISTSIZE=10000
HISTFILESIZE=100000
HISTFILE="$XDG_DATA_HOME/bash/history"
HISTCONTROL=ignoreboth:erasedups
HISTIGNORE=" *:%[0-9]:&:[bf]g:cd:cd ..:cd [-~]:clear:exit:ls:pwd"
[ -d "${HISTFILE%/*}" ] || mkdir -p "${HISTFILE%/*}"
LANG="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
export LANG LC_CTYPE LC_ALL
EDITOR="vim"
VISUAL="vim"
SUDO_EDITOR="vim -n -i NONE"
PAGER="less"
MANPAGER="less"
BROWSER="open"
export EDITOR VISUAL SUDO_EDITOR PAGER MANPAGER BROWSER
# F - exit if content fits on one screen
# M - show line numbers in prompt
# R - output ANSI colors
# X - don't clear screen on exit
# j.5 - center search results
# q - quiet, visual bell
LESS="FMRXj.5q"
LESSHISTFILE=-
export LESS LESSHISTFILE
export NODE_REPL_HISTORY="$XDG_DATA_HOME/node/repl_history"
LSCOLORS=ExGxFxdxCxfxDxxbadacad
LS_COLORS="di=1;34:ln=1;36:so=1;35:pi=33:ex=1;32:bd=35:cd=1;33:su=0;41:sg=30;43:tw=30;42:ow=30;43"
export LSCOLORS LS_COLORS
export RIPGREP_CONFIG_PATH="$XDG_CONFIG_HOME/rg/config"
export KUBECTL_EXTERNAL_DIFF=kubectl-diff-helper
export GOPRIVATE=github.com/jacknagel
if [ -r "$NIX_PROFILE/etc/profile.d/bash_completion.sh" ]; then
# shellcheck disable=2034
BASH_COMPLETION_COMPAT_DIR=$NIX_PROFILE/etc/bash_completion.d
. "$NIX_PROFILE/etc/profile.d/bash_completion.sh"
fi
if [ -r "$NIX_PROFILE/share/bash-completion/completions/git-prompt.sh" ]; then
. "$NIX_PROFILE/share/bash-completion/completions/git-prompt.sh"
elif [ -r /etc/bash_completion.d/git-prompt ]; then
. /etc/bash_completion.d/git-prompt
else
git_prompt_path=$(xcode-select -print-path 2>/dev/null)/usr/share/git-core/git-prompt.sh
if [ -r "$git_prompt_path" ]; then
. "$git_prompt_path"
fi
fi
# shellcheck disable=SC2034
{
GIT_PS1_DESCRIBE_STYLE=branch
GIT_PS1_SHOWCOLORHINTS=1
GIT_PS1_SHOWCONFLICTSTATE=1
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWSTASHSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
GIT_PS1_SHOWUPSTREAM=auto
}
if declare -F __git_ps1 >/dev/null; then
_set_ps1 () {
__git_ps1 "$@"
}
else
_set_ps1 () { PS1="$1$2"; }
fi
_prompt_command () {
local template='_set_ps1 "{{ title "\\w" }}{{ user | suffix " " }}{{ aws | parens | suffix " " }}{{ kubeconfig | parens | suffix " " }}{{ nixshell | parens | suffix " "}}{{ pwd }}" " {{ promptchar }} " " {{ parens "%s" }}"'
eval "$(prompt-template "$template" 2>/dev/null)"
history -a
}
PROMPT_COMMAND=_prompt_command
_source_completion () {
local aliases
aliases=$(alias)
unalias -a
. "$1" >/dev/null 2>&1 || return 1
eval "$aliases"
return 124
}
_load_completion () {
case "$1" in
node) _source_completion <(node --completion-bash) ;;
docker) _source_completion /Applications/Docker.app/Contents/Resources/etc/docker.bash-completion ;;
docker-compose) _source_completion /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion ;;
op) _source_completion <(op completion bash) ;;
esac
}
if [ -d "/Applications/Docker.app" ]; then
complete -F _load_completion -o bashdefault -o default docker docker-compose
fi
if command -v node >/dev/null 2>&1; then
complete -F _load_completion -o bashdefault -o default node
fi
if command -v terraform >/dev/null 2>&1; then
complete -C terraform terraform
fi
if command -v op >/dev/null 2>&1; then
complete -F _load_completion -o bashdefault -o default op
fi
if [ -r "$NIX_PROFILE/bin/complete_alias" ]; then
. "$NIX_PROFILE/bin/complete_alias" 2>/dev/null
complete -F _complete_alias "${!BASH_ALIASES[@]}" 2>/dev/null
fi