-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbash_aliases
100 lines (73 loc) · 2.43 KB
/
bash_aliases
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
ARCH=$(uname -s)
# disable terminal freeze when clicking Ctrl-s
stty -ixon
export LC_ALL=en_US.UTF-8
# use non-black color for `null` values for the jq command
export JQ_COLORS="1;35:0;39:0;39:0;39:0;32:1;39:1;39"
alias targz_extract="tar -xvf"
# lite vim (no plugins or vimrc)
alias lvim="vim -u NONE"
alias vi=nvim
alias vim=nvim
alias v=vim
alias g=git
# go to root of repo
alias cdr='cd $(git rev-parse --show-toplevel)'
# change default editors for git & similar cli tools
export VISUAL=nvim
export EDITOR=nvim
export GIT_EDITOR=nvim
alias docker_rmi_all='docker rmi $(docker images -a -q)'
alias docker_stop_all='docker stop $(docker ps -a -q)'
alias docker_rm_all='docker rm $(docker ps -a -q)'
alias json_prettify="python -m json.tool"
alias loccntgo="loccnt \"*.go\" \"*_test.go\" \"mocks*\" \"vendor*\""
loccnt() {
if [ -z $1 ]; then
echo "Usage: ${FUNCNAME[0]} <included> <excluded>"
return
fi
excluded=""
for i in "${@:2}"; do
# old version, which doesn't work. This matches filename patterns only, but doesn't work for filepaths.
# excluded="$excluded ! -iname \"$i\""
excluded="$excluded ! -path \"$i\""
done
cmd="find . -type f \( -iname \"$1\" $excluded \) | xargs wc -l"
eval "$cmd"
}
if [ $ARCH = 'Darwin' ]; then
# use emacs key bindings for the terminal
set -o emacs
alias chrome="open -a \"Google Chrome\""
# make macos use openssl for cpp compiles
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include -I/usr/local/include -L/usr/local/lib"
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
precmd() { eval "$PROMPT_COMMAND" }
fi
# run gdb until program bombs & print stack trace
alias gdb_trace="gdb --batch --ex r --ex bt --ex q --args"
PATH=$PATH:/usr/local/go/bin
PATH=$PATH:~/scripts
# Go environment
PATH=$PATH:~/prg/go/bin
export GOPATH=$HOME/prg/go
export FZF_DEFAULT_OPTS='
--color fg:252,bg:233,hl:#ff8787,fg+:252,bg+:235,hl+:#ff0000
--color info:144,prompt:161,spinner:135,pointer:135,marker:118'
# make prompt appear above cursor
HOST_CLR='\033[1;49;92m'
# make prompt colorful
if [ $ARCH = 'Darwin' ]; then
DIR_CLR='\033[1;38;5;208m'
else
DIR_CLR='\033[1;34m'
fi
NC='\033[0m'
PROMPT_COMMAND='echo -e "${HOST_CLR}$(whoami)@lannisport${NC}:${DIR_CLR}$(dirs)${NC}"'
PS1='$ '
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
if [[ ! $TERM =~ screen ]]; then
tmux && exit
fi