aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'zsh')
-rw-r--r--zsh/.config/zsh/.zshrc53
-rw-r--r--zsh/.config/zsh/.zshrc.d/20-autosuggest.zsh4
-rwxr-xr-xzsh/.config/zsh/.zshrc.d/99-compinit.zsh42
-rwxr-xr-xzsh/install.sh13
4 files changed, 38 insertions, 74 deletions
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc
index 86625b0..51a4a2a 100644
--- a/zsh/.config/zsh/.zshrc
+++ b/zsh/.config/zsh/.zshrc
@@ -1,33 +1,22 @@
#!/bin/zsh
-export HYPHEN_INSENSITIVE="true"
-export DISABLE_UPDATE_PROMPT="true"
-export DISABLE_AUTO_TITLE="true"
-export HISTFILE="$XDG_STATE_HOME/zsh/history"
-export HISTSIZE=10000
-export SAVEHIST=10000
-export DIRSTACKSIZE=20
-
-setopt NO_BEEP
-setopt MENU_COMPLETE
-setopt AUTO_CD
-setopt AUTO_PUSHD
-setopt PUSHD_SILENT
-setopt PUSHD_TO_HOME
-setopt PUSHD_IGNORE_DUPS
-setopt EXTENDED_HISTORY
-setopt SHARE_HISTORY
-setopt HIST_EXPIRE_DUPS_FIRST
-setopt HIST_IGNORE_DUPS
-setopt HIST_IGNORE_SPACE
-setopt HIST_VERIFY
-setopt NONOMATCH
-setopt CORRECT
-setopt INTERACTIVE_COMMENTS
-
-TRAPUSR1() {
- rehash
-}
+HISTFILE="${XDG_STATE_HOME}/zsh/history"
+HISTSIZE=10000
+SAVEHIST=10000
+
+setopt no_beep
+setopt menu_complete
+setopt auto_pushd
+setopt pushd_silent
+setopt pushd_ignore_dups
+setopt extended_history
+setopt share_history
+setopt hist_expire_dups_first
+setopt hist_ignore_dups
+setopt hist_ignore_space
+setopt hist_verify
+setopt nonomatch
+setopt interactive_comments
bindkey -v
bindkey -m 2>/dev/null
@@ -37,8 +26,6 @@ zle -N select-word-style
select-word-style normal
zstyle :zle:transpose-words word-style shell
-# TODO: improve this with terminfo validation
-#
# See: https://wiki.archlinux.org/title/Zsh#Key_bindings
bindkey '^[q' push-line
bindkey '^[[Z' reverse-menu-complete
@@ -48,6 +35,7 @@ bindkey '^[[3~' delete-char
bindkey '^[[1;5C' forward-word
bindkey '^[[1;5D' backward-word
bindkey '^[t' transpose-words
+bindkey '^ ' forward-word
bindkey -M vicmd '^[q' push-line
bindkey -M vicmd '^[[Z' reverse-menu-complete
@@ -72,8 +60,3 @@ for script in "$XDG_CONFIG_HOME"/zsh/.zshrc.d/*.zsh; do
source "$script"
fi
done
-
-bindkey '^ ' forward-word
-
-autoload -Uz compinit
-compinit
diff --git a/zsh/.config/zsh/.zshrc.d/20-autosuggest.zsh b/zsh/.config/zsh/.zshrc.d/20-autosuggest.zsh
index 0b18c55..12c5bb0 100644
--- a/zsh/.config/zsh/.zshrc.d/20-autosuggest.zsh
+++ b/zsh/.config/zsh/.zshrc.d/20-autosuggest.zsh
@@ -1,8 +1,4 @@
#!/bin/zsh
-# vim:ft=sh
-
-bindkey '^ ' autosuggest-accept
-bindkey -M vicmd '^ ' autosuggest-accept
export ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd completion)
export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#4f4738"
diff --git a/zsh/.config/zsh/.zshrc.d/99-compinit.zsh b/zsh/.config/zsh/.zshrc.d/99-compinit.zsh
index 580749d..236d86a 100755
--- a/zsh/.config/zsh/.zshrc.d/99-compinit.zsh
+++ b/zsh/.config/zsh/.zshrc.d/99-compinit.zsh
@@ -1,40 +1,12 @@
#!/bin/zsh
+zstyle ':completion:*' use-cache true
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/zcompcache"
-# Load all stock functions (from $fpath files) called below.
-autoload -U compaudit compinit
+autoload -U compinit
+compinit -u -C -d "${XDG_CACHE_HOME}/zsh/zcompdump"
-# Figure out the SHORT hostname
-if [[ "$OSTYPE" = darwin* ]]; then
- # macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
- SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
-else
- SHORT_HOST=${HOST/.*/}
-fi
-
-# Save the location of the current completion dump file.
-ZSH_COMPDUMP="${XDG_CACHE_HOME}/zsh/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
-mkdir -p "${XDG_CACHE_HOME}/zsh"
-
-# Construct zcompdump metadata, we will rebuild the Zsh compdump if either
-# this file changes or the fpath changes.
-zcompdump_revision="#revision: $(sha1sum $0:A)"
-zcompdump_fpath="#fpath: $fpath"
-
-# Delete the zcompdump file if zcompdump metadata changed
-if ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null ||
- ! command grep -q -Fx "$zcompdump_fpath" "$ZSH_COMPDUMP" 2>/dev/null; then
- command rm -f "$ZSH_COMPDUMP"
- zcompdump_refresh=1
-fi
-
-# If the user wants it, load from all found directories
-compinit -u -C -d "${ZSH_COMPDUMP}"
-
-# Append zcompdump metadata if missing
-if (( $zcompdump_refresh )); then
- echo "\n$zcompdump_revision\n$zcompdump_fpath" >>! "$ZSH_COMPDUMP"
-fi
-
-unset zcompdump_revision zcompdump_fpath zcompdump_refresh
+TRAPUSR1() {
+ rehash
+ compdump
+}
diff --git a/zsh/install.sh b/zsh/install.sh
new file mode 100755
index 0000000..2c6b871
--- /dev/null
+++ b/zsh/install.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if ! command -v "zsh" >/dev/null; then
+ printf "%s: zsh not found, skipping...\n" "$0"
+ exit 0
+fi
+
+mkdir -p "${XDG_CACHE_HOME}/zsh"
+
+zsh -s <<EOF
+ autoload -U compinit
+ compinit -u -d "${XDG_CACHE_HOME}/zsh/zcompdump"
+EOF