-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
113 lines (97 loc) · 2.5 KB
/
.zshrc
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
export VISUAL=nvim
export EDITOR="$VISUAL"
# Base16 Shell
BASE16_SHELL="$HOME/.config/base16-shell/"
[ -n "$PS1" ] && \
[ -s "$BASE16_SHELL/profile_helper.sh" ] && \
eval "$("$BASE16_SHELL/profile_helper.sh")"
# load zgen
source "${HOME}/.zgen/zgen.zsh"
# export android environment variables
export ANDROID_HOME=$HOME/Android/Sdk
export ANDROID_SDK_ROOT=$HOME/Android/Sdk
export ANDROID_AVD_HOME=$HOME/.android/avd
# if the init script doesn't exist
if ! zgen saved; then
# plugins
zgen oh-my-zsh
zgen oh-my-zsh themes/ys
zgen oh-my-zsh plugins/git
zgen load zsh-users/zsh-syntax-highlighting
zgen load zsh-users/zsh-autosuggestions
zgen load mfaerevaag/wd
# generate the init script from plugins above (remember to call zgen update and zgen reset)
zgen save
fi
# ctrl+Space to accept autosuggestions
bindkey '^ ' autosuggest-accept
# combine mkdir and cd
function mkcd {
mkdir $1 && cd $1
}
# images
function img {
sxiv -r $@ >/dev/null 2>&1 &
}
# pdf
function pdf {
if [[ $1 == *.pdf ]]; then
evince $1 >/dev/null 2>&1 &
elif [[ -d $1 ]]; then
for f in $1/*.pdf; do
evince $f >/dev/null 2>&1 &
done
fi
}
# weather
function wttr {
if [ -n "$1" ]; then
curl wttr.in/$1
else
curl wttr.in
fi
}
# additional git aliases
alias grl="git reflog"
alias gdn="git diff --name-only"
alias gdc="git diff --compact-summary"
alias gstw="git stash show"
alias gstap="git stash push --patch"
alias gcop="git checkout --patch"
alias gcn="git clean"
alias gcnn="git clean --dry-run"
alias gcnf="git clean --force"
# git merge squash
function gms {
trackingBranch=$1
git merge --squash $trackingBranch || { echo 'merge-squashing failed' ; return 1; }
git commit -m "squashed $trackingBranch"
}
# git cherry-spit
function gcsp {
if [ "$#" -ne 2 ]; then
echo "please give me 2 parameters (a commit hash and a branch name)"
return 1;
fi
echo "cherry-spitting $1 onto $2"
git checkout $2 || { echo 'cherry-spit failed' ; return 1; }
git cherry-pick $1 || { return 1; }
git checkout -
}
alias lg="lazygit"
# timewarrior
alias tw="timew"
alias tws="timew start"
alias twp="timew stop"
alias twt="timew track"
alias twd="timew day"
alias tww="timew week"
alias twm="timew month"
function watchMd2Pdf {
file=$1
md-to-pdf $file
open -a skim "${file%.*}.pdf"
md-to-pdf --watch $file &
}
[[ -f ~/.grc.zsh ]] && source ~/.grc.zsh
[[ -f ~/.fzf.zsh ]] && source ~/.fzf.zsh