-
Notifications
You must be signed in to change notification settings - Fork 0
/
zsh.conf
115 lines (100 loc) · 2.83 KB
/
zsh.conf
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
# You can put files here to add functionality separated per file, which
# will be ignored by git.
# Files on the custom/ directory will be automatically loaded by the init
# script, in alphabetical order.
# For example: add yourself some shortcuts to projects you often work on.
#
# brainstormr=~/Projects/development/planetargon/brainstormr
# cd $brainstormr
#
#[[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh
alias cls='clear'
if [ "$(uname)" = "Darwin" ]; then
else
alias pbcopy='xclip -i -selection "clipboard"'
fi
# git
alias gbvv="git branch -vv"
alias gprom="git pull --rebase origin master"
alias gpo="git push origin HEAD:refs/for/master"
alias grh='git reset HEAD '
alias gsl='git stash list'
alias bp='python3 -m bpython'
alias bat='bat -p'
alias pyt='conda activate term'
alias pyk='conda deactivate'
alias rsz='source ~/.zshrc'
alias vi='NVIM_TUI_ENABLE_TRUE_COLOR=1 nvim'
alias vd='nvim -d'
alias cl='clang++ -std=c++14 -g'
alias grep="grep --color=auto"
alias dict="dict.py"
alias sms="sms.py"
alias cntdwn="countdown.py"
alias hugooo="hugo server --buildDrafts -t hugo_theme_beg"
alias fn="find . -name "
alias lod="./llvm-objdump -disassemble "
alias sdcv="sdcv -n -e -c -0 "
alias sshaws='ssh -i "~/.stan.pem" ubuntu@ec2-18-223-247-163.us-east-2.compute.amazonaws.com'
alias -s c=vi
alias -s cpp=vi
alias -s js=vi
alias -s txt=vi
alias -s gz='tar -xzvf'
alias -s tgz='tar -xzvf'
alias -s zip='unzip'
alias -s bz2='tar -xjvf'
#v - open files in ~/.viminfo
v() {
local files
files=$(grep '^>' ~/.viminfo | cut -c3- |
while read line; do
[ -f "${line/\~/$HOME}" ] && echo "$line"
done | fzf-tmux -d -m -q "$*" -1) && vi ${files//\~/$HOME}
}
o() {
local out file key
IFS=$'\n' out=($(fzf-tmux --query="$1" --exit-0 --expect=ctrl-o,ctrl-e))
key=$(head -1 <<< "$out")
file=$(head -2 <<< "$out" | tail -1)
if [ -n "$file" ]; then
[ "$key" = ctrl-o ] && open "$file" || ${EDITOR:-vim} "$file"
fi
}
calc() {
python3 -c "from math import*; print($1)"
}
wttr() {
local addr=${1:-'Cambridge'}
curl "wttr.in/$addr"
}
gdd() {
git difftool -y -x "colordiff -y -W $COLUMNS" $1 | less -R
}
pathjoin() {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
notify() {
local arg=${2:-''}
notify-send -u critical $1 $2
}
prev() {
PREV=$(fc -lrn | head -n 1)
sh -c "pet new `printf %q "$PREV"`"
}
fgl() {
git log --graph --color=always \
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort \
--bind "ctrl-m:execute:
(grep -o '[a-f0-9]\{7\}' | head -1 |
xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF'
{}
FZF-EOF"
}