-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
112 lines (94 loc) · 3.34 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
# default editor
export EDITOR="nvim"
alias vim=nvim
# enable terminal coloring
export CLICOLOR=1
# color improvement
export LSCOLORS=GxFxCxDxBxegedabagaced
# Bash 4.x features
shopt -s globstar
# source envs
source $HOME/.envs
# dev binaries
export PATH="$HOME/Dev/bin:$PATH"
# start ssh-agent
ssh-add ~/.ssh/id_rsa 2>/dev/null
# util aliases
alias ..='cd ..'
alias ll="exa -l"
alias ld="ls -ld */"
alias digg='dig +noall +answer'
# history stuff
HISTSIZE=50000
HISTFILESIZE=50000
export HISTCONTROL=ignoreboth:erasedups
export HISTTIMEFORMAT="%d/%m/%y %T "
# brew
export PATH="/opt/homebrew/sbin:$PATH"
export PATH="/opt/homebrew/bin:$PATH"
export HOMEBREW_GITHUB_API_TOKEN=$GITHUB_TOKEN_NO_SCOPE
export BREW_PREFIX=`brew --prefix`
# auto-switch-defaultbrowser
export PATH=$PATH:$HOME/.scripts/auto-switch-defaultbrowser
# autojump
[ -f $BREW_PREFIX/etc/profile.d/autojump.sh ] && . $BREW_PREFIX/etc/profile.d/autojump.sh
# bash-completion
[[ -r "$BREW_PREFIX/etc/profile.d/bash_completion.sh" ]] && . "$BREW_PREFIX/etc/profile.d/bash_completion.sh"
# broot - directory tree explorer
source $HOME/Library/Preferences/org.dystroy.broot/launcher/bash/br
# dotfiles cfg
alias dots='/usr/bin/git --git-dir=$HOME/.dots/ --work-tree=$HOME'
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dots/ --work-tree=$HOME'
# fzf
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
export FZF_DEFAULT_COMMAND='fd --type f'
export FZF_DEFAULT_OPTS='--height 40% --border'
export FZF_TMUX=1
export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200'"
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"
# gh
export GITHUB_TOKEN=$GITHUB_TOKEN_REPO_READORG
# git helpers
gitclean() {
git br --merged | grep -v -E "master|main|$(git branch --show-current)" | xargs git br -d
}
gitcoma() {
git checkout $(git branch | cut -c 3- | grep -E '^master$|^main$')
}
gitfresh() {
gitcoma && git pull && gitclean
}
alias githead="git log | head -1 | awk '{print \$2}'"
alias ghcp="githead | tr -d '\n' | pbcopy"
# golang
export GOPATH="$HOME/Dev/go"
export GOBIN="$GOPATH/bin"
export PATH="$GOBIN:$PATH"
# kubectl
alias k="kubectl"
complete -o default -F __start_kubectl k
# man customization:
# use GNU manpages for programs that are GNU ones, and fallback to OSX manpages otherwise
alias man='_() { echo $1; man -M $(brew --prefix)/opt/coreutils/libexec/gnuman $1 1>/dev/null 2>&1; if [ "$?" -eq 0 ]; then man -M $(brew --prefix)/opt/coreutils/libexec/gnuman $1; else man $1; fi }; _'
MANPATH="$BREW_PREFIX/opt/coreutils/libexec/gnuman:$MANPATH"
# node
export PATH="node_modules/.bin:$PATH"
# prompt '>' / '$' customization
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
source "$BREW_PREFIX/opt/kube-ps1/share/kube-ps1.sh"
export KUBE_PS1_SYMBOL_COLOR="green"
export KUBE_PS1_SYMBOL_ENABLE="false"
export PS1="\W\[\033[32m\]\$(parse_git_branch)\[\033[00m\]\$(kube_ps1)\$ "
# rust
export PATH="$HOME/.cargo/bin:$PATH"
# ssl helper
function certg() {
printf "openssl s_client -showcerts -servername $1 -connect ${1}:443 </dev/null"
openssl s_client -showcerts -servername $1 -connect ${1}:443 </dev/null
}
# uw
export AWS_PROFILE=iam-dev
export GOOGLE_CREDENTIALS=/root/.config/gcloud/uw-terraform-sa.json