aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'zsh')
-rw-r--r--zsh/.config/zsh/.zshrc2
-rwxr-xr-xzsh/.local/share/zsh/plugins/compinit.plugin.zsh38
2 files changed, 39 insertions, 1 deletions
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc
index d19c33d..3971353 100644
--- a/zsh/.config/zsh/.zshrc
+++ b/zsh/.config/zsh/.zshrc
@@ -52,7 +52,7 @@ alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
alias tlmgr='/usr/share/texmf-dist/scripts/texlive/tlmgr.pl --usermode'
alias unlock='echo "" | gpg --clearsign --verbose && ssh -T git@github.com'
-SHELDON_PROFILE="$(uname -r | sed 's/^.*-//g' 2>/dev/null)"
+SHELDON_PROFILE="$(uname -r 2>/dev/null | rev | cut -d- -f1 | rev)"
export SHELDON_PROFILE
export ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern line)
export ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd completion)
diff --git a/zsh/.local/share/zsh/plugins/compinit.plugin.zsh b/zsh/.local/share/zsh/plugins/compinit.plugin.zsh
new file mode 100755
index 0000000..e213248
--- /dev/null
+++ b/zsh/.local/share/zsh/plugins/compinit.plugin.zsh
@@ -0,0 +1,38 @@
+#!/bin/zsh
+
+# Load all stock functions (from $fpath files) called below.
+autoload -U compaudit compinit
+
+# 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