Repository navigation
Expand file tree
/
Copy path.bashrc
More file actions
139 lines (115 loc) · 3.9 KB
/
Copy path.bashrc
File metadata and controls
139 lines (115 loc) · 3.9 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
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
#
# ~/.bashrc - startup file for Bash interactive shell
#
# References:
# - https://github.com/mloskot/archlinux-config/blob/master/home/mloskot/.bashrc
# - https://wiki.archlinux.org/index.php/Color_Bash_Prompt
#
if [[ $- != *i* ]]; then
# Running non-interactively, don't do anything
return
fi
echo "Sourcing ${HOME}/.bashrc..."
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
# if an ssh session start the ssh agent
if [[ -n $SSH_CLIENT ]]; then
mkdir -p /tmp/ssh-$USER
pkill -u $USER ssh-agent
eval $(ssh-agent -s -a /tmp/ssh-$USER/ssh-agent.socket)
fi
# create symlink ~/.ssh/ssh_auth_sock to the ssh-agent socket. This is
# used for tmux sessions.
#
# see these links for more information:
# https://gist.github.com/bcomnes/e756624dc1d126ba2eb6
# http://techblog.appnexus.com/2011/managing-ssh-sockets-in-gnu-screen/
# https://gist.github.com/martijnvermaat/8070533
# http://stackoverflow.com/questions/21378569/how-to-auto-update-ssh-agent-environment-variables-when-attaching-to-existing-tm
if [[ -S $SSH_AUTH_SOCK && ! -L $SSH_AUTH_SOCK ]]; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
if which dircolors 2>/dev/null && [[ "$TERM" != "dumb" ]]; then
eval "$(dircolors -b)"
alias ls='ls --color=auto'
fi
source ${HOME}/.git-completion.bash
source ${HOME}/.git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
GIT_PS1_SHOWSTASHSTATE=1
GIT_PS1_SHOWUPSTREAM="verbose"
# set prompt
case "$TERM" in
xterm* | screen*)
PS1='[\u@\h \[\033[1;35m\]\W$(__git_ps1 " \[\033[1;34m\](%s)")\[\033[0m\]]\$ '
;;
*)
PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
;;
esac
# direnv
# https://github.com/direnv/direnv/wiki/Python#restoring-the-ps1
show_virtual_env() {
if [[ -n "$VIRTUAL_ENV" && -n "$DIRENV_DIR" ]]; then
echo "($(basename $VIRTUAL_ENV))"
fi
}
#export -f show_virtual_env
PS1='$(show_virtual_env)'$PS1
export PYTHONSTARTUP=${HOME}/.pythonrc.py
export PIP_REQUIRE_VIRTUALENV=true
export EDITOR=nvim
export CDPATH=.:${HOME}/src
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export LESS="-RXF"
# fzf
# https://github.com/junegunn/fzf
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
export FZF_DEFAULT_COMMAND='ag --nocolor -g ""'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_DEFAULT_OPTS='
--color fg:242,bg:236,hl:65,fg+:15,bg+:239,hl+:108
--color info:108,prompt:109,spinner:108,pointer:168,marker:168
'
# direnv
which direnv
if [ $? -eq 0 ]; then
eval "$(direnv hook bash)"
else
eval "$(/opt/homebrew/bin/direnv hook bash)"
fi
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
if [ -f ~/.bash_functions ]; then
. ~/.bash_functions
fi
if [ -f /etc/profile.d/autojump.bash ]; then
source /etc/profile.d/autojump.bash
fi
# gcloud
if [ -f ~/soft/google-cloud-sdk/path.bash.inc ]; then
. ~/soft/google-cloud-sdk/path.bash.inc
fi
if [ -f ~/soft/google-cloud-sdk/completion.bash.inc ]; then
. ~/soft/google-cloud-sdk/completion.bash.inc
fi
# pyenv
export PYENV_ROOT="${HOME}/.pyenv"
export PYENV_SHELL=bash
# nvm
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# bash-completion@2
[[ -r "/opt/homebrew/etc/profile.d/bash_completion.sh" ]] && . "/opt/homebrew/etc/profile.d/bash_completion.sh"
[[ -r "/opt/homebrew/etc/bash_completion.d/000_bash_completion_compat.bash" ]] && . "/opt/homebrew/etc/bash_completion.d/000_bash_completion_compat.bash"
_split_longopt() { _comp__split_longopt "$@"; }