-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
84 lines (60 loc) · 1.86 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
# ref: https://medium.com/@rukurx/zsh%E3%81%AEcompinit%E3%81%AB%E6%8C%87%E5%AE%9A%E3%81%97%E3%81%A6%E3%82%8Bautoload%E3%81%AE%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3-uz-%E3%81%AB%E3%81%A4%E3%81%84%E3%81%A6-ad471efd84c3
autoload -Uz colors && colors
autoload -Uz compinit
autoload -Uz history-search-end
autoload -Uz add-zsh-hook
## Homebrew
if [ "$(uname)" = 'Linux' ]; then
# Set PATH, MANPATH, etc., for Homebrew.
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
## Runtime
if [ -f ${XDG_BIN_HOME}/mise ]; then
eval "$(${XDG_BIN_HOME}/mise activate zsh)"
fi
# ref: http://fnwiya.hatenablog.com/entry/2015/11/03/191902
if [ -d $ZSH_CONFIG_DIR -a -r $ZSH_CONFIG_DIR -a \
-x $ZSH_CONFIG_DIR ]; then
for i in $ZSH_CONFIG_DIR/*; do
[[ ${i##*/} = *.sh || ${i##*/} = *.zsh ]] &&
[ \( -f $i -o -h $i \) -a -r $i ] && . $i
done
fi
## Misc
bindkey -e
setopt correct
## Aliases
alias c="code"
alias g="git"
alias t="tmux"
alias v="vim"
## Completion
# ref: https://gist.github.com/ctechols/ca1035271ad134841284#gistcomment-2308206
for dump in ~/.zcompdump(N.mh+24); do
compinit
done
compinit -C
# ref: http://gihyo.jp/dev/serial/01/zsh-book/0005
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z} r:|[-_.]=**'
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}'
## History
HISTFILE=$HOME/.command_history
HISTSIZE=50000
SAVEHIST=50000
setopt share_history
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
## Keybind
bindkey "^P" history-beginning-search-backward-end
bindkey "^N" history-beginning-search-forward-end
## Prompt
setopt prompt_subst
PROMPT='
[%n] `show_current_path` `git_current_branch`
`status_code`'
PROMPT2='[%n]> '
SPROMPT='`suggest`'
## Profiling (Must set to end of file)
if (which zprof > /dev/null 2>&1) ;then
zprof
fi