-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
130 lines (105 loc) · 3.44 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
# shellcheck shell=bash
# shellcheck disable=SC1091
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
os_name="$(uname)"
if [[ $os_name == "Darwin" ]]; then
MAC_OS=true
else
MAC_OS=false
fi
if [[ "$(uname -o)" = Msys ]]; then
# Make symlinks work more how you'd expect
export MSYS=winsymlinks:nativestrict
fi
umask 0002
# alias various commands
if [ -r "$HOME/.bashrc.aliases" ]; then
source "$HOME/.bashrc.aliases"
fi
# add bash completions
if [ -r "$HOME/.bashrc.completions" ]; then
source "$HOME/.bashrc.completions"
fi
# "$(tput sitm)" is probably safest here, but actually it seems easier to just
# not use italics at all, because terminfo is annoying to setup if they're not
# already supported
YEL='\[\e[93m\]'
BLU='\[\e[0;36m\]'
GRE='\[\e[0;32m\]'
RED='\[\e[0;31m\]'
MAG='\[\e[0;35m\]'
ENDCOL='\[\e[0m\]'
# shellcheck disable=SC2016
SUCCESS='$(if [ $? -eq 0 ]; then printf "'"$GRE"'"; else printf "'"$RED"'"; fi)'
if declare -F __git_ps1 >/dev/null; then
PROMPT_COMMAND='__git_ps1'
PROMPT_COMMAND+=' "${MAG}${DOCKER_NAME:+(${DOCKER_NAME}) }${ENDCOL}[\u@\h] ${BLU}\W${ENDCOL} "'
PROMPT_COMMAND+=' "\n${SUCCESS}\$${ENDCOL} "'
# shellcheck disable=SC2089
PROMPT_COMMAND+=' "${YEL}(%s)${ENDCOL}"'
# shellcheck disable=SC2090
export PROMPT_COMMAND
else
export PS1="${MAG}${DOCKER_NAME:+(${DOCKER_NAME}) }${ENDCOL}[\u@\h] ${BLU}\W${ENDCOL}\n${SUCCESS}\$${ENDCOL} "
fi
if [[ ":$PATH:" != *":$HOME/.cargo/bin:"* ]]; then
export PATH="$HOME/.cargo/bin:$PATH"
fi
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi
export PATH="/usr/local/opt/node@8/bin:$PATH"
# Explicit XDG dirs for Windows (i.e. gitbash)
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"
# `history` timestamp in output
export HISTTIMEFORMAT="%F %T "
# https://stackoverflow.com/a/39352670
export LESS=Rx4
if [ "$MAC_OS" = true ]; then
# (macOS) set up LS colors
export CLICOLOR=1
dir=Gx # bold cyan/default
symlink=Fx # bold magenta/default
sock=Cx # bold green/default
pipe=Dx # bold yellow/default
exe=Bx # bold red/default
block=eg # blue/cyan
char="ed" # blue/yellow
setuid=ab # black/red
setguid=ag # black/cyan
sticky=ac # black/green
nostick="ed" # blue/yellow
export LSCOLORS=$dir$symlink$sock$pipe$exe$block$char$setuid$setguid$sticky$nostick
fi
export LNAV_EXP="mouse"
export EDITOR="vim"
export SUDO_EDITOR="vim"
export PYTHONSTARTUP=$HOME/.pythonrc.py
# disable ctrl-s = suspend session
[[ $- == *i* ]] && stty -ixon
if which thefuck &>/dev/null; then
eval "$(thefuck --alias)"
fi
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
if which pyenv &>/dev/null && [[ "$(uname -o)" != Msys ]]; then
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
fi
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && source "$NVM_DIR/bash_completion" # This loads nvm bash_completion
if [ -f "$HOME/bin/git-completion.bash" ]; then
source "$HOME/bin/git-completion.bash"
fi
if [ -f "$HOME/bin/git-prompt.sh" ]; then
source "$HOME/bin/git-prompt.sh"
PS1=${DOCKER_NAME:+(${DOCKER_NAME})}'[\u@\h \W$(__git_ps1 " (%s)")]\$ '
fi
if test -f "$HOME/.cargo/env"; then
source "$HOME/.cargo/env"
fi