-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
70 lines (59 loc) · 1.76 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
autoload -Uz compinit && compinit
which gawk > /dev/null && alias awk=gawk
which gdate > /dev/null && alias date=gdate
which gcut > /dev/null && alias cut=gcut
which gegrep > /dev/null && alias egrep=gegrep
which gfgrep > /dev/null && alias fgrep=gfgrep
which ggrep > /dev/null && alias grep=ggrep
which ghead > /dev/null && alias head=ghead
which gls > /dev/null && alias ls=gls
which gsed > /dev/null && alias sed=gsed
which gtail > /dev/null && alias tail=gtail
which gtar > /dev/null && alias tar=gtar
alias ll='ls -l'
eval "$(starship init zsh)"
eval "$(rbenv init - zsh)"
# pyenv
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
# Go
export PATH=$PATH:~/go/bin
function _peco-ghq() {
local src=$(ghq list --full-path | peco --query "$LBUFFER")
if [ -n "$src" ]; then
BUFFER="cd $src"
zle accept-line
fi
zle -R -c
}
zle -N _peco-ghq
bindkey '^]' _peco-ghq
function _peco-git-switch() {
local branch=$(git branch | peco | sed -e 's/ //g' -e 's/^\*//')
if [ -n "${branch}" ]; then
BUFFER="git switch ${branch}"
zle accept-line
fi
zle clear-screen
}
zle -N _peco-git-switch
bindkey '^w' _peco-git-switch
function _peco-git-fetch-remote() {
local remote_branch=$(git br -r | peco | sed -e 's/ //g' -e 's/^\*//' -e 's/->.*//')
if [ -n "${remote_branch}" ]; then
remote=$(echo ${remote_branch} | cut -d/ -f1)
branch=$(echo ${remote_branch} | cut -d/ -f2-)
BUFFER="git fetch ${remote} ${branch} && git switch ${branch}"
zle accept-line
fi
zle clear-screen
}
zle -N _peco-git-fetch-remote
# k8s
alias k=kubectl
[[ /usr/local/bin/kubectl ]] && source <(kubectl completion zsh)
files=$(test -d ~/.zsh.d && ls ~/.zsh.d/*)
for file in ${files}; do
source ${file}
done