-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbashrc
149 lines (121 loc) · 3.48 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
#!/bin/bash
# shellcheck disable=SC1090,SC1091
# Enable 'hash' command to find executables
set -h
if [ "$(uname -s)" == "Darwin" ]; then
export BASH_SILENCE_DEPRECATION_WARNING=1
fi
HOMEBREW_BIN="/usr/local/bin/brew"
if [ "$(uname -m)" == "arm64" ]; then
HOMEBREW_BIN="/opt/homebrew/bin/brew"
fi
if [ -x $HOMEBREW_BIN ]; then
eval "$($HOMEBREW_BIN shellenv)"
fi
if [[ -d "${HOMEBREW_PREFIX}/opt/coreutils/libexec/" ]]; then
export PATH="${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnubin:$PATH"
export MANPATH="${HOMEBREW_PREFIX}/opt/coreutils/libexec/gnuman:$MANPATH"
fi
alias df='df -h'
alias du='du -sh'
alias free='free -m'
alias git-sh='source $HOME/.bash-git-prompt/gitprompt.sh'
alias grep='grep --color=auto'
alias la='ls --color=auto -lha'
alias ll='ls --color=auto -lh'
alias ls='ls --color=auto'
alias scpi='scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
alias sshi='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
alias tree="tree -I 'node_modules|vendor'"
alias xclip='xclip -sel clip'
for bc in \
"/etc/bash_completion" \
"${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" \
"${HOME}/.nix-profile/etc/profile.d/bash_completion.sh" \
; do
if [[ -f "$bc" ]]; then
. "$bc"
break
fi
done
eval "$(dircolors)"
if hash vim 2> /dev/null; then
EDITOR=$(command -v vim)
export EDITOR
fi
if [[ -f /etc/redhat-release ]]; then
PS1_SEP=" "
else
PS1_SEP=":"
fi
# Prompt colors
BLUE='\[\e[94;1m\]'
CLEAR='\[\e[0m\]'
CYAN='\[\e[96;1m\]'
RED='\[\e[91;1m\]'
WHITE='\[\e[97;1m\]'
export PS1="[${RED}\\u${CYAN}@${BLUE}\\h${CLEAR}${PS1_SEP}${WHITE}\\w${CLEAR}]\\$ "
# Short prompt for presentations:
function short_prompt {
export PS1="${WHITE}\\$ $CLEAR"
}
if [[ -f "$HOME/.no_history" ]]; then
unset HISTFILE
else
export HISTCONTROL="ignoreboth:erasedups"
export HISTSIZE=10000
fi
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
# Custom applications
export BAT_THEME="Monokai Extended"
if [[ -d "$HOME/.asdf" ]]; then
source "$HOME/.asdf/asdf.sh"
source "$HOME/.asdf/completions/asdf.bash"
export ASDF_GOLANG_MOD_VERSION_ENABLED=true
fi
if [[ -d "$HOME/.google-cloud-sdk" ]]; then
source "$HOME/.google-cloud-sdk/path.bash.inc"
source "$HOME/.google-cloud-sdk/completion.bash.inc"
fi
if hash go 2> /dev/null; then
GOBIN=$(go env GOPATH)/bin
export PATH="$GOBIN:$PATH"
fi
LOCALE_FOLDER="${HOME}/.nix-profile/lib/locale"
if [[ -d "$LOCALE_FOLDER" ]]; then
export LOCALE_ARCHIVE="${LOCALE_FOLDER}/locale-archive"
fi
if [[ -d "/snap/bin" ]]; then
export PATH="/snap/bin:$PATH"
fi
# Fix SSH_AUTH_SOCK for screen sessions
if [[ -S "$SSH_AUTH_SOCK" && ! -h "$SSH_AUTH_SOCK" ]]; then
ln -fs "$SSH_AUTH_SOCK" "$HOME/.ssh/ssh_auth_sock"
fi
export SSH_AUTH_SOCK="$HOME/.ssh/ssh_auth_sock"
case "$TERM" in
screen*)
export TERM="screen-256color"
;;
xterm*)
export TERM="xterm-256color"
;;
esac
# Vi mode for interactive terminal:
if [[ $- == *i* ]]; then
bind -m vi-insert '\C-l':clear-screen
set -o vi
fi
# fzf should be configured after vi mode:
if [[ -f "$HOME/.fzf.bash" ]]; then
source "$HOME/.fzf.bash"
if hash ag 2> /dev/null; then
export FZF_DEFAULT_COMMAND='ag -g ""'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
fi
export FZF_DEFAULT_OPTS="--height 100%"
export FZF_CTRL_T_OPTS="--preview 'head -100 {}'"
fi
# User-specific executables should be the first in $PATH:
export PATH="${HOME}/.local/bin:$PATH"