-
Notifications
You must be signed in to change notification settings - Fork 2
/
bash_profile
138 lines (104 loc) · 3.33 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
set -o vi
export EDITOR=vim
alias f='open -a Finder ./'
alias ll='ls -FGlAhp'
alias ls="ls -F"
# export PS1='[\u \W$(__git_ps1 " (%s)")]\$ '
# For Ruby installed by homebrew
export PATH=/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.7.0/bin:$PATH
export PATH=~/bin:/usr/local/bin:$PATH
export PATH=~/go/bin:$PATH
export PATH=/usr/local/anaconda3/bin:$PATH
brew_prefix=$(brew --prefix)
# For diff-highlight. See http://theunixtoolbox.com/git-diff-highlight/
PATH=$PATH:$brew_prefix/share/git-core/contrib/diff-highlight
if [ -f $brew_prefix/share/bash-completion/bash_completion ]; then
. $brew_prefix/share/bash-completion/bash_completion
fi
if [ -f $brew_prefix/opt/bash-git-prompt/share/gitprompt.sh ]; then
GIT_PROMPT_THEME=Default
source $brew_prefix/opt/bash-git-prompt/share/gitprompt.sh
# . ~/dotfiles/git-prompt-overrides.sh
fi
# export HOMEBREW_GITHUB_API_TOKEN=
# MenubarNotifier function
# https://github.com/alexglasser/menubarnotifier
mn () {
~/bin/menubarnotifier.py "$1" 2>/dev/null &
}
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
#export GREP_OPTIONS='--color=auto'
alias grep='ggrep --color=auto'
export GPG_TTY=$(tty)
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"
# This is annoyingly slow
#export PATH=$HOME/.jenv/bin:$PATH
# eval "$(jenv init -)"
[ -s "/usr/local/etc/grc.bashrc" ] && . "/usr/local/etc/grc.bashrc" # Colourise with grc
# Better syntax highlighting, but no handling of binary files
# LESSPIPE=`which src-hilite-lesspipe.sh`
# export LESSOPEN="| ${LESSPIPE} %s"
# export LESS=' -R'
# Nice binary handling, not as good for syntax highlighting
export LESSOPEN="|/usr/local/bin/lesspipe.sh %s" LESS_ADVANCED_PREPROCESSOR=1
export LESS='-XFR'
lesscolors()
{
#LESS=' -R' \
LESSPIPE=`which src-hilite-lesspipe.sh` \
LESSOPEN='| ${LESSPIPE} %s' \
$(which less) $@
}
realpath() {
OURPWD=$PWD
cd "$(dirname "$1")"
LINK=$(readlink "$(basename "$1")")
while [ "$LINK" ]; do
cd "$(dirname "$LINK")"
LINK=$(readlink "$(basename "$1")")
done
REALPATH="$PWD/$(basename "$1")"
cd "$OURPWD"
echo "$REALPATH"
}
less()
{
less=$(which less)
has_file=false
all_text=true
for arg in $@; do
if [[ "$arg" != -* ]] && [ -e "$arg" ]; then
has_file=true
enc=$(file -b --mime-encoding "$(realpath $arg)")
if [[ "$enc" != *"-ascii" ]] && [ "$enc" != "utf-8" ]; then
all_text=false
break
fi
fi
done
if [ $has_file == true ] && [ "$all_text" == true ]; then
less=lesscolors
fi
$less $@
}
alias more=less
export PAGER=less
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_INTERACTIVE_CLI_TELEMETRY_OPTOUT=1
# bash parameter completion for the dotnet CLI
_dotnet_bash_complete()
{
local word=${COMP_WORDS[COMP_CWORD]}
local completions
completions="$(dotnet complete --position "${COMP_POINT}" "${COMP_LINE}" 2>/dev/null)"
if [ $? -ne 0 ]; then
completions=""
fi
COMPREPLY=( $(compgen -W "$completions" -- "$word") )
}
complete -f -F _dotnet_bash_complete dotnet
# Executed after reading a command and before executing it. Will restore the cursor to a block
export PS0="\e[2 q"
# Use 1Password for SSH. It's all automatic, based on ~/.ssh/config, but this allows ssh-add -l to work
export SSH_AUTH_SOCK=~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock