-
Notifications
You must be signed in to change notification settings - Fork 11
/
.bashrc
executable file
·75 lines (59 loc) · 2.28 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
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /'
}
PS1='\u@\h at \[\e[32m\]\w \[\e[91m\]$(parse_git_branch)\[\e[00m\]\$ '
[[ ${TERM} == "xterm-termite" ]] && export TERM=xterm-256color
command -v nvim &> /dev/null && export EDITOR=nvim
command -v lsd &> /dev/null && alias ls="lsd --header"
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export XDG_CONFIG_HOME=${HOME}/.config
export XDG_CACHE_HOME=${HOME}/.cache
export HISTTIMEFORMAT="%F %T "
export HISTSIZE=11000
export HISTFILESIZE=11000
export HISTCONTROL=ignoredups:erasedups
export HOMEBREW_EDITOR=${EDITOR}
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_INSTALL_FROM_API=1
export HOMEBREW_API_DOMAIN="https://mirrors.aliyun.com/homebrew-bottles/api"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/homebrew-core.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.aliyun.com/homebrew/homebrew-bottles"
export GO11MODULE=on
export GOPATH=${HOME}/.go
export GOPROXY=https://goproxy.cn,direct
export FZF_DEFAULT_OPTS="--height=20% --reverse"
export FZF_DEFAULT_COMMAND="fd --type f --strip-cwd-prefix --exclude={.git,build,thirdparty,vendor}"
function add_path() {
export PATH=${PATH}:$1
}
add_path ${GOPATH}/bin
add_path ${HOME}/.local/bin
add_path ${HOME}/.node_modules/bin
# copied from https://bit.ly/3ZhgVjz
function fssh() {
host=$(grep "^Host " ${HOME}/.ssh/config | cut -b 6- | fzf --prompt="SSH > " --preview="awk -v HOST={} -f ~/.ssh/host2conf.awk ~/.ssh/config")
[ $? -eq 0 ] && ssh ${host}
}
function fbr() {
local branches branch
branches=$(git branch --all | grep -v HEAD) &&
branch=$(echo "$branches" | fzf -d $(( 2 + $(wc -l <<< "$branches") )) +m) &&
git checkout $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##")
}
alias bashconfig="source ${HOME}/.bashrc"
alias ll="ls -lh"
alias la="ll -a"
alias brewfile="brew bundle dump --global -f"
# only for macos java installed by brew
if [[ $(uname -o) == "Darwin" ]]; then
export PATH="/usr/local/opt/openjdk/bin:$PATH"
export CPPFLAGS="-I/usr/local/opt/openjdk/include"
fi