-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbash_profile
118 lines (95 loc) · 3.39 KB
/
bash_profile
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
# Add `~/bin` to the `$PATH`
export PATH="$HOME/code/dotfiles/bin:$PATH";
export PATH="/usr/local/opt/bison/bin:$PATH";
export LDFLAGS="-L/usr/local/opt/bison/lib";
export EDITOR="vim";
export BASH_SILENCE_DEPRECATION_WARNING=1
export MANPGER="sh -c 'col -bx | bat -l man -p'"
# Set PATH, MANPATH, etc., for Homebrew.
eval "$(/opt/homebrew/bin/brew shellenv)"
# export THRIFT="/usr/local/bin/thrift-0.9.3";
# export THRIFT_11="/usr/local/bin/thrift-0.11.0";
# export LD_LIBRARY_PATH="/usr/local/lib/:$LD_LIBRARY_PATH";
# Load the shell dotfiles, and then some:
# * ~/.path can be used to extend `$PATH`.
# * ~/.extra can be used for other settings you don’t want to commit.
for file in ~/.{path,bash_prompt,exports,aliases,functions,extra}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file";
done;
unset file;
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
### NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Run 'nvm use' automatically every time there's
# a .nvmrc file in the directory. Also, revert to default
# version when entering a directory without .nvmrc
enter_directory() {
if [[ $PWD == $PREV_PWD ]]; then
return
fi
PREV_PWD=$PWD
if [[ -f ".nvmrc" ]]; then
nvm use
NVM_DIRTY=true
elif [[ $NVM_DIRTY = true ]]; then
nvm use default
NVM_DIRTY=false
fi
}
export PROMPT_COMMAND=enter_directory
### NVM
# Case-insensitive globbing (used in pathname expansion)
shopt -s nocaseglob;
# Append to the Bash history file, rather than overwriting it
shopt -s histappend;
# Autocorrect typos in path names when using `cd`
shopt -s cdspell;
# Enable some Bash 4 features when possible:
# * `autocd`, e.g. `**/qux` will enter `./foo/bar/baz/qux`
# * Recursive globbing, e.g. `echo **/*.txt`
for option in autocd globstar; do
shopt -s "$option" 2> /dev/null;
done;
# Add tab completion for many Bash commands
if which brew &> /dev/null && [ -r "$(brew --prefix)/etc/profile.d/bash_completion.sh" ]; then
# Ensure existing Homebrew v1 completions continue to work
export BASH_COMPLETION_COMPAT_DIR="$(brew --prefix)/etc/bash_completion.d";
source "$(brew --prefix)/etc/profile.d/bash_completion.sh";
elif [ -f /etc/bash_completion ]; then
source /etc/bash_completion;
fi;
# # Open new tab on working directory
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} history -n"
eval "$(rbenv init -)"
eval "$(zoxide init bash)"
# Git auto complete ---
# brew install bash-completion
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
# Enable tab completion for `g` by marking it as an alias for `git`
# Note: not working
if type _git &> /dev/null; then
complete -o default -o nospace -F _git g;
fi;
# --- Git auto complete
# View git diff with bat ---
gdiff() {
git diff --name-only --diff-filter=d | xargs bat --diff
}
# --- View git diff with bat
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
# __conda_setup="$('/opt/miniconda2/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
# if [ $? -eq 0 ]; then
# eval "$__conda_setup"
# else
# if [ -f "/opt/miniconda2/etc/profile.d/conda.sh" ]; then
# . "/opt/miniconda2/etc/profile.d/conda.sh"
# else
# export PATH="/opt/miniconda2/bin:$PATH"
# fi
# fi
# unset __conda_setup
# <<< conda initialize <<<
. "$HOME/.cargo/env"