forked from mathiasbynens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
113 lines (86 loc) · 3.23 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
104
105
106
107
108
109
110
111
112
113
#!/bin/zsh
# zsh interactive configuration
# This file is sourced in interactive login and interactive non-login mode,
# after .zshenv and .zprofile
# It should source .profile manually if needed.
# It should contain your basic zsh configuration.
# set source guard
if [ -n "$__ZSHRC" ]; then return; fi
export __ZSHRC="true"
unset BASH
#echo "executing .zshrc ..."
# Core definitions
if [[ -r "$HOME"/.profile ]]; then
source "$HOME"/.profile
fi
# Prompt configuration
P10K_INIT="${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
if [[ -r "$P10K_INIT" ]]; then
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
source "$P10K_INIT"
elif type starship &>/dev/null; then
# Starship cross-platform prompt
eval "$(starship init zsh)"
elif [[ -r "$HOME"/.zsh_prompt ]]; then
# Basic prompt
source "$HOME"/.zsh_prompt
elif [[ -r /etc/zshrc ]]; then
# Fallback to system config
source /etc/zshrc
fi
# Module customization pre-fix
# Use bash-like word definitions for navigation and operations
autoload -Uz select-word-style
select-word-style bash
# https://github.com/zimfw/zimfw
# Definitions
ZIM_HOME=~/.zim
zstyle ':zim' disable-version-check yes
# Download zimfw plugin manager if missing.
if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then
curl -fsSL --create-dirs -o ${ZIM_HOME}/zimfw.zsh \
https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh
fi
# Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated.
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
source ${ZIM_HOME}/zimfw.zsh init -q
fi
# Initialize modules.
source ${ZIM_HOME}/init.zsh
# Module customization post-fix
# Do not trim trailing slash
#setopt no_auto_remove_slash
# Don't buffer very long lines for autosuggest
export ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=100
# zsh-autocomplete delay (seconds)
zstyle ':autocomplete:*' delay 0.1
# zsh-autocomplete Tab behavior
# first insert the common substring (Tab or Shift-Tab)
zstyle ':autocomplete:*complete*:*' insert-unambiguous yes
zstyle ':autocomplete:*history*:*' insert-unambiguous yes
zstyle ':autocomplete:menu-search:*' insert-unambiguous yes
# Make Tab and Shift-Tab cycle completions on the command line
# bindkey '\t' menu-complete "$terminfo[kcbt]" reverse-menu-complete
# Make Tab go straight to the menu and cycle there
# bindkey '\t' menu-select "$terminfo[kcbt]" menu-select
# bindkey -M menuselect '\t' menu-complete "$terminfo[kcbt]" reverse-menu-complete
# https://github.com/zimfw/completion/issues/10
zstyle ':completion:*' matcher-list \
'm:{[:lower:]-}={[:upper:]_} r:|[.]=**' \
'+l:|=*'
# Custom functions
function source_if () {
for file in "$@"; do
#echo "sourcing $file ..."
test -r "$file" && source "$file"
done
}
source_if "$HOME"/.functions
# https://code.visualstudio.com/docs/terminal/shell-integration
# [[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path zsh)"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# unset source guard
unset __ZSHRC