-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.zshrc.win
117 lines (105 loc) · 3.03 KB
/
.zshrc.win
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
116
117
# load zgen
source "${HOME}/.zgen/zgen.zsh"
# check if there's no init script
if ! zgen saved; then
echo "Creating a zgen save"
zgen oh-my-zsh
# plugins
zgen oh-my-zsh plugins/git
# zgen oh-my-zsh plugins/sudo
# zgen oh-my-zsh plugins/command-not-found
zgen load zsh-users/zsh-syntax-highlighting
# zgen load zsh-users/zsh-history-substring-search
zgen load zsh-users/zsh-completions src
# zgen load wbinglee/zsh-wakatime
# save all to init script
zgen save
fi
PROMPT='[%*]%{$fg_bold[green]%} %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}%{$reset_color%}%(?.%{$fg[green]%}.%{$fg[red]%})%B%(!.#.$)%b '
function chpwd() {
powered_cd_add_log
}
function powered_cd_add_log() {
local i=0
cat ~/.powered_cd.log | while read line; do
(( i++ ))
if [ i = 30 ]; then
sed -i -e "30,30d" ~/.powered_cd.log
elif [ "$line" = "$PWD" ]; then
sed -i -e "${i},${i}d" ~/.powered_cd.log
fi
done
echo "$PWD" >> ~/.powered_cd.log
}
function powered_cd() {
if which gtac > /dev/null; then
tac="gtac"
else
tac="tac"
fi
if [ $# = 0 ]; then
cd $(eval $tac ~/.powered_cd.log | fzy)
elif [ $# = 1 ]; then
cd $1
else
echo "powered_cd: too many arguments"
fi
}
_powered_cd() {
_files -/
}
compdef _powered_cd powered_cd
[ -e ~/.powered_cd.log ] || touch ~/.powered_cd.log
alias c="powered_cd"
# function fzy-select-history() {
# local tac
# if which tac > /dev/null; then
# tac="tac"
# else
# tac="tail -r"
# fi
# BUFFER=$(\history -nr 1 | awk '!a[$0]++' | \
# eval $tac | \
# fzy --query "$LBUFFER")
# CURSOR=$#BUFFER
# zle clear-screen
# }
# zle -N fzy-select-history
# bindkey '^r' fzy-select-history
# history
HIST_STAMPS="yyyy/mm/dd"
# go
export PATH=$PATH:/usr/local/go/bin
export PATH=$HOME/project/bin:$PATH
export GOPATH=$HOME/project
# node
# export PATH=$HOME/.nodebrew/current/bin:$PATH
# nodebrew use stable
export PATH=$PATH:./node_modules/.bin
export PATH="$HOME/.yarn/bin:$PATH"
# alias
# unalias gb
alias gdw="git diff --color-words"
alias ggpull="git pull origin $(current_branch)"
alias ggpush="git push origin $(current_branch)"
alias gh='cd $(ghq list -p | fzy)'
alias glogg='git log --graph --name-status --pretty=format:"%C(red)%h %C(green)%an %Creset%s %C(yellow)%d%Creset"'
alias dstat='dstat -tlamp'
alias grebase='git rebase -i $(git log --date=short --pretty="format:%h %cd %ae %d %s" |fzy| cut -d" " -f1)'
alias rg="rg -S"
alias gbrc="~/dotfiles/bin/git-checkout-remote-branch"
# tmux
#alias tmux="LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/tmux"
show-current-dir-as-window-name() {
tmux set-window-option window-status-format " #I: ${PWD:t} " > /dev/null
tmux set-window-option window-status-current-format " #I: ${PWD:t} " > /dev/null
}
show-current-dir-as-window-name
add-zsh-hook chpwd show-current-dir-as-window-name
# vim
export EDITOR='vim'
# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
[ -f ~/.zsh-private ] && source ~/.zsh-private
if (which zprof > /dev/null) ;then
zprof | less
fi