-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot_zshrc
109 lines (90 loc) · 4.15 KB
/
dot_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
declare -A ZINIT
ZINIT[BIN_DIR]="${HOME}/.local/share/zinit"
if [[ ! -d "$ZINIT[BIN_DIR]" || ! -f "$ZINIT[BIN_DIR]/zinit.zsh" ]]; then
mkdir -p "$ZINIT[BIN_DIR]"
echo "Installing Zinit to $ZINIT[BIN_DIR]"
tmpdir=$(mktemp -d)
git clone --depth=1 --no-checkout [email protected]:zdharma-continuum/zinit.git "$tmpdir"
cp -r "$tmpdir/.git" "$ZINIT[BIN_DIR]"
rm -rf "$tmpdir"
cd "$ZINIT[BIN_DIR]"
git checkout
cd -
fi
source "${ZINIT[BIN_DIR]}/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
autoload -Uz compinit
compinit
ZI_PROTO='proto=ssh'
ZI_FROM='[email protected]'
#ZI_FROM="from=hub.nuaa.cf"
zstyle ':completion:*' menu select
zi $ZI_PROTO $ZI_FROM depth'1' wait lucid for \
light-mode \
zdharma-continuum/fast-syntax-highlighting \
blockf \
zsh-users/zsh-completions \
atload"!_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions
#zi ice $ZI_PROTO $ZI_FROM lucid wait='!0' compile'(pure|async).zsh' pick'async.zsh' src'pure.zsh'
#zi light sindresorhus/pure
zi light _local/cmdtime
PS1='%F{green}%~%f%(?..!%F{red}%?%f)%(!.#.$) '
HISTSIZE=10000
SAVEHIST=10000
setopt BANG_HIST # Perform textual history expansion, csh-style, treating the character `!' specially.
# setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits. Conflict with `share_history'.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
# setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded previously.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
bindkey -e
# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
typeset -g -A key
key[Home]="${terminfo[khome]}"
key[End]="${terminfo[kend]}"
key[Insert]="${terminfo[kich1]}"
key[Backspace]="${terminfo[kbs]}"
key[Delete]="${terminfo[kdch1]}"
key[Up]="${terminfo[kcuu1]}"
key[Down]="${terminfo[kcud1]}"
key[Left]="${terminfo[kcub1]}"
key[Right]="${terminfo[kcuf1]}"
key[PageUp]="${terminfo[kpp]}"
key[PageDown]="${terminfo[knp]}"
key[Shift-Tab]="${terminfo[kcbt]}"
# setup key accordingly
[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode
[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char
[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history
[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
autoload -Uz add-zle-hook-widget
function zle_application_mode_start { echoti smkx }
function zle_application_mode_stop { echoti rmkx }
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
fi
autoload -z edit-command-line
zle -N edit-command-line
bindkey '^x^e' edit-command-line
bindkey -s '\eo' 'cd ..\n'
[ -f "$HOME/scripts/function/commonrc.sh" ] && source "$HOME/scripts/function/commonrc.sh"
zi $ZI_PROTO $ZI_FROM depth'1' wait lucid for \
has'fzf' \
Aloxaf/fzf-tab