Refactored sourcing methods for .zsh files in .zshrc
This commit is contained in:
parent
0ece17ca70
commit
7f61b716ed
50
.zshrc
50
.zshrc
@ -183,44 +183,28 @@ if [ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then
|
|||||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999'
|
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load zplug and extensions
|
# Function that goes thorugh each argument and attempts to source it if it exists.
|
||||||
if [ -f "$HOME/.zplug/init.zsh" ]; then
|
function attempt-source() {
|
||||||
source "$HOME/.zplug/init.zsh"
|
for arg in "$@"; do
|
||||||
elif [ -f "/opt/homebrew/Cellar/zplug/2.4.2/init.zsh" ]; then
|
if [ -f "$arg" ]; then
|
||||||
source "/opt/homebrew/Cellar/zplug/2.4.2/init.zsh"
|
source "$arg"
|
||||||
fi
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Failed to source $(basename $1)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Load zplug and extensions
|
||||||
|
attempt-source "$HOME/.zplug/init.zsh" "/usr/share/zplug/init.zsh" "/opt/homebrew/Cellar/zplug/2.4.2/init.zsh"
|
||||||
zplug romkatv/powerlevel10k, as:theme, depth:1
|
zplug romkatv/powerlevel10k, as:theme, depth:1
|
||||||
zplug load
|
zplug load
|
||||||
|
|
||||||
# Source completion and highlighting scripts
|
# Source completion and highlighting scripts
|
||||||
if [ -f "/usr/share/fzf/completion.zsh" ]; then
|
attempt-source "/usr/share/fzf/completion.zsh" "/usr/share/doc/fzf/examples/completion.zsh" "/usr/share/doc/fzf/examples/completion.zsh" /opt/homebrew/Cellar/fzf/*/shell/completion.zsh
|
||||||
source "/usr/share/fzf/completion.zsh"
|
attempt-source "/usr/share/fzf/key-bindings.zsh" "/usr/share/doc/fzf/examples/key-bindings.zsh" /opt/homebrew/Cellar/fzf/*/shell/key-bindings.zsh
|
||||||
elif [ -f /opt/homebrew/Cellar/fzf/*/shell/completion.zsh ]; then
|
attempt-source "/usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh" "/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" "/opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||||||
source /opt/homebrew/Cellar/fzf/*/shell/completion.zsh
|
#attempt-source "/usr/share/doc/pkgfile/command-not-found.zsh"
|
||||||
else
|
|
||||||
echo "completion.zsh not installed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "/usr/share/fzf/key-bindings.zsh" ]; then
|
|
||||||
source /usr/share/fzf/key-bindings.zsh
|
|
||||||
elif [ -f /opt/homebrew/Cellar/fzf/*/shell/key-bindings.zsh ]; then
|
|
||||||
source /opt/homebrew/Cellar/fzf/*/shell/key-bindings.zsh
|
|
||||||
else
|
|
||||||
echo "key-bindings.zsh not installed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "/usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh" ]; then
|
|
||||||
source /usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh
|
|
||||||
elif [ -f "/opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]; then
|
|
||||||
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
||||||
else
|
|
||||||
echo "zsh-autosuggestions.zsh not installed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "/usr/share/doc/pkgfile/command-not-found.zsh" ]; then
|
|
||||||
source /usr/share/doc/pkgfile/command-not-found.zsh
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Fix arch linux valgrind issue.
|
# Fix arch linux valgrind issue.
|
||||||
[[ $(uname -r) == *"arch"* ]] && export DEBUGINFOD_URLS="https://debuginfod.archlinux.org"
|
[[ $(uname -r) == *"arch"* ]] && export DEBUGINFOD_URLS="https://debuginfod.archlinux.org"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user