summaryrefslogtreecommitdiff
path: root/zsh/.zshrc
diff options
context:
space:
mode:
Diffstat (limited to 'zsh/.zshrc')
-rw-r--r--zsh/.zshrc86
1 files changed, 54 insertions, 32 deletions
diff --git a/zsh/.zshrc b/zsh/.zshrc
index 791b5d1..e08bb20 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -1,16 +1,4 @@
#zmodload zsh/zprof
-if [ -n "$ZPLUG_HOME" ]; then
- if [ -d "$ZPLUG_HOME" ]; then
- export ZPLUG_INSTALLED="y"
- source "$ZPLUG_HOME/init.zsh"
- fi
-elif [ -d "$XDG_DATA_HOME/zplug" ]; then
- export ZPLUG_INSTALLED="y"
- source "$XDG_DATA_HOME/zplug/init.zsh"
-elif [ -d "$HOME/.zplug" ]; then
- export ZPLUG_INSTALLED="y"
- source "$HOME/.zplug/init.zsh"
-fi
[ -z "$XDG_CONFIG_HOME" ] && XDG_CONFIG_HOME="$HOME/.config"
HISTFILE="$XDG_CONFIG_HOME/zsh/hist"
SAVEHIST=1000
@@ -70,31 +58,65 @@ export KEYTIMEOUT=1
#fpath+="$XDG_CONFIG_HOME/zsh/zfunc"
-if [ -n "$ZPLUG_INSTALLED" ]; then
- # zsh history substring search
- zplug "zsh-users/zsh-history-substring-search", as:plugin
-
- bindkey "${key[Up]}" history-substring-search-up
- bindkey "${key[Down]}" history-substring-search-down
- bindkey -M vicmd "${key[Up]}" history-substring-search-up
- bindkey -M vicmd "${key[Down]}" history-substring-search-down
- bindkey -M vicmd "k" history-substring-search-up
- bindkey -M vicmd "j" history-substring-search-down
-
- # zsh syntax highlighting
- zplug "zsh-users/zsh-syntax-highlighting", defer:2
-
- # load zsh plugins
- zplug load
-fi
-
autoload -Uz compinit
if [[ -n ${ZDOTDIR}/.zcompdump(#qN.mh+24) ]]; then
compinit
else
- compinit -C;
-fi;
+ compinit -C
+fi
+
+zshcache_time="$(date +%s%N)"
+
+autoload -Uz add-zsh-hook
+
+rehash_precmd() {
+ if [[ -a /var/cache/zsh/pacman ]]; then
+ local paccache_time="$(date -r /var/cache/zsh/pacman +%s%N)"
+ if (( zshcache_time < paccache_time )); then
+ rehash
+ zshcache_time="$paccache_time"
+ fi
+ fi
+}
+
+add-zsh-hook -Uz precmd rehash_precmd
zstyle ':completion:*' hosts off
+### Added by Zinit's installer
+if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
+ print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
+ command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
+ command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
+ print -P "%F{33} %F{34}Installation successful.%f%b" || \
+ print -P "%F{160} The clone has failed.%f%b"
+fi
+
+source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
+autoload -Uz _zinit
+(( ${+_comps} )) && _comps[zinit]=_zinit
+
+# Load a few important annexes, without Turbo
+# (this is currently required for annexes)
+zinit light-mode for \
+ zdharma-continuum/zinit-annex-as-monitor \
+ zdharma-continuum/zinit-annex-bin-gem-node \
+ zdharma-continuum/zinit-annex-patch-dl \
+ zdharma-continuum/zinit-annex-rust
+
+### End of Zinit's installer chunk
+zinit snippet OMZ::plugins/git/git.plugin.zsh
+
+zinit load 'zsh-users/zsh-history-substring-search'
+zinit ice wait atload'_history_substring_search_config'
+
+bindkey "${key[Up]}" history-substring-search-up
+bindkey "${key[Down]}" history-substring-search-down
+bindkey -M vicmd "${key[Up]}" history-substring-search-up
+bindkey -M vicmd "${key[Down]}" history-substring-search-down
+bindkey -M vicmd "k" history-substring-search-up
+bindkey -M vicmd "j" history-substring-search-down
+
+source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
+
#zprof