-
Notifications
You must be signed in to change notification settings - Fork 10
/
.zshrc
103 lines (77 loc) · 2.66 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Completion for other programs
fpath=($ZDOTDIR/completions/ $fpath)
# My own defined autoload functions under ~/.config/zsh/functions/
autoload_functions_dir="$ZDOTDIR/functions"
fpath+=$autoload_functions_dir
autoload -Uz ${autoload_functions_dir}/*(.:t)
# Uncomment lines below if not using the completion module in Zimfw
# autoload -Uz compinit
# compinit
# Zimfw
if [[ ${ZIM_HOME}/init.zsh -ot ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
source ${ZIM_HOME}/zimfw.zsh init -q
fi
source ${ZIM_HOME}/init.zsh
# The prefix for the alias from zim builtin git module
#zstyle ':zim:git' aliases-prefix 'g'
# Append `../` to your input for each `.` you type after an initial `..`
zstyle ':zim:input' double-dot-expand yes
# zsh-syntax-highlighting
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
# fzf-tab
zstyle ':fzf-tab:*' fzf-flags '--preview-window=hidden,<9999(hidden)'
zstyle ':fzf-tab:*' fzf-preview 'echo Preview is not available!'
zstyle ':fzf-tab:*' fzf-pad 4
# Ensure add-zsh-hook is available
autoload -Uz add-zsh-hook
# Remove duplicated commands in history
setopt HIST_IGNORE_ALL_DUPS
# Make right prompt aligned to the rightmost
ZLE_RPROMPT_INDENT=0
# Change open files limit on macOS
ulimit -n 524288
ulimit -u 2048
# Use menu selection for completion
zstyle ':completion:*' menu select
zmodload zsh/complist
# Include hidden files in autocomplete
_comp_options+=(globdots)
# Completion for other programs
fpath=($ZDOTDIR/completions/ $fpath)
# For kitty kitten: hyperlinked grep (defined in ~/.config/zsh/functions/hg)
# Delegate its completion to rg
compdef _rg hg
# Make ngl (~/.config/zsh/functions/ngl) support autocomplete as `git log`
compdef _ngl ngl
_ngl() {
(( $+functions[_git-log] )) || _git
_git-log
}
# Make ngd (~/.config/zsh/functions/ngd) support autocomplete as `git difftool`
compdef _ngd ngd
_ngd() {
(( $+functions[_git-difftool] )) || _git
_git-difftool
}
# Auto-cd if the command is a directory and can't be executed as a normal command
setopt auto_cd
# When deleting with <C-w>, delete file names at a time.
WORDCHARS=${WORDCHARS/\/}
source "$ZDOTDIR/aliases"
source "$ZDOTDIR/keybindings"
# source "$ZDOTDIR/vi" # use vi mode
source "$ZDOTDIR/env"
# fzf
source "$HOME/.config/fzf/fzf-config"
# Rust
source "$HOME/.cargo/env"
# iTerm2 Shell Integration
export ITERM2_SQUELCH_MARK=1
test -e "${ZDOTDIR}/iterm2_shell_integration.zsh" && source "${ZDOTDIR}/iterm2_shell_integration.zsh"
# Wezterm Shell Integration
[[ -n $WEZTERM_CONFIG_DIR ]] && test -e "${ZDOTDIR}/wezterm_shell_integration.sh" && source "${ZDOTDIR}/wezterm_shell_integration.sh"
# zoxide
source $HOME/.config/zoxide/zoxide-config
eval "$(zoxide init zsh)"
# Starship
eval "$(starship init zsh)"