-
Notifications
You must be signed in to change notification settings - Fork 2
/
.bashrc
72 lines (56 loc) · 1.64 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
#!/usr/bin/env bash
# shellcheck disable=SC1091
export PS1="[\u@\h \W]\\$ "
# force dircolors.
export CLICOLOR=1
# asdf
source "$HOME"/.asdf/asdf.sh
source "$HOME"/.asdf/completions/asdf.bash
# docker
export DOCKER_CLI_HINTS=false
# macos.
if [[ $(uname) == "Darwin" ]]; then
# disable homebrew analytics.
export HOMEBREW_NO_ANALYTICS=1
# put homebrew's sbin in the path.
PATH="$(brew --prefix)/sbin:$PATH"
# git bash completion
source "$(brew --prefix)"/etc/bash_completion.d/git-completion.bash
# homebrew changed default path to /opt/homebrew,
# and other tools (docker in particular) still
# symlink cli binaries in /usr/local/bin by default.
PATH="/usr/local/bin:$PATH"
# TeX binaries for pandoc.
PATH="/Library/TeX/Root/bin/universal-darwin/:$PATH"
fi
# utility functions
git-prune-sync() {
if [ $# -eq 0 ]; then
local remote=origin
else
local remote=$1
fi
if [ "$(type -P git)" ]; then
git remote prune "$remote"
echo "pruned $remote branch references."
if git rev-parse --git-dir > /dev/null 2>&1; then
gone_remote_branches=$(git branch -vv | grep "gone" | awk "{print \$1}")
if [[ -z "$gone_remote_branches" ]]; then
echo "no local branches track a gone $remote branch."
else
for gone_remote_branch in $gone_remote_branches; do
echo "$gone_remote_branch" | xargs git branch -D
done
fi
else
echo "not a git repository."
fi
else
echo "'git' command not available. check your installation."
fi
}
export PATH
# load host-specific shell configuration.
if [ -f "$HOME"/.this_machine ]; then
source "$HOME"/.this_machine
fi