-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy path_zshrc
72 lines (59 loc) · 2.31 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
# Enable case-insensitive auto-complete
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# zinit configurations
autoload -Uz compinit
compinit
# This can be useful when pasting large amount of text in the terminal, to avoid triggering
# autosuggestion for strings that are too long.
# see https://github.com/zsh-users/zsh-autosuggestions#disabling-suggestion-for-large-buffers
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
ZSH_AUTOSUGGEST_USE_ASYNC=1
if command -v zinit &> /dev/null; then
zinit for \
light-mode zsh-users/zsh-autosuggestions \
light-mode zdharma/fast-syntax-highlighting \
zdharma/history-search-multi-word
zinit snippet OMZP::git
zinit snippet OMZ::lib/completion.zsh
zinit snippet OMZ::lib/history.zsh
zinit snippet OMZ::lib/key-bindings.zsh
zinit snippet OMZ::lib/theme-and-appearance.zsh
fi
_THIS_DIR=$(dirname ${(%):-%N})
source $_THIS_DIR/shellrc
# Ohyyzsh beceme too slow in large git repository,
# See https://github.com/ohmyzsh/ohmyzsh/issues/3009
if [[ $ZSH =~ .*\.oh-my-zsh ]]; then
git config --global --add oh-my-zsh.hide-dirty 1
git config --global --add oh-my-zsh.hide-status 1
fi
# zsh 5.8 disabled this option defaultly,
# see https://github.com/advisories/GHSA-735j-r9q6-48mw
setopt PROMPT_SUBST
# Using shorter prompt in vscode terminal
if [[ "$TERM_PROGRAM" == "vscode" ]]; then
export PS1=$'%(4~|.../%3~|%~)\e[32m$(parse_git_branch)\e[m%# '
else
export PS1=$'%(5~|%-2~/…/%3~|%4~)\e[32m$(parse_git_branch)\e[m%# '
fi
# HOME, END and DELETE key
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
bindkey "\e[3~" delete-char
bindkey "\e[A" history-search-backward
bindkey "\e[B" history-search-forward
# Shift-Left/Right to move work by word
bindkey "\e[1;2D" backward-word
bindkey "\e[1;2C" forward-word
# Ctrl-Left/Right, same as above, for XShell
bindkey "\e[1;5D" backward-word
bindkey "\e[1;5C" forward-word
# Fix problem: Directory color is too dark on Mac
# https://github.com/sorin-ionescu/prezto/issues/1539
if [ ls --color -d . >/dev/null 2>&1 ]; then
eval "$(gdircolors ${HOME}/.dir_colors)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
else
export LSCOLORS="gxfxbEaEBxxEhEhBaDaCaD"
zstyle ':completion:*:default' list-colors ${(s.:.)LSCOLORS}
fi