diff options
author | Dennis Eriksen <d@ennis.no> | 2024-06-10 11:15:31 +0200 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2024-06-10 11:15:31 +0200 |
commit | bbd9b9207b37be749b981eb39fbacbe2a19ecc5f (patch) | |
tree | e919194ca75b316bc0f62c344a4a516fb47d98ce | |
parent | Fixing README (diff) | |
download | idgatt-bbd9b9207b37be749b981eb39fbacbe2a19ecc5f.tar.gz |
rename include_or to include_first
-rw-r--r-- | zsh/.zsh/.zshrc | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/zsh/.zsh/.zshrc b/zsh/.zsh/.zshrc index fe542ce..0321a2e 100644 --- a/zsh/.zsh/.zshrc +++ b/zsh/.zsh/.zshrc @@ -44,7 +44,7 @@ have() { (( $+commands[$1] )) } include() { [[ -f $1 && -r $1 ]] && source $1 } # source first file found -include_or() { +include_first() { local f for f in $@; do if [[ -f $f && -r $f ]]; then @@ -558,21 +558,21 @@ zle -N -- _zle-cd-up # fzf! if have fzf; then - include_or "$ZDOTDIR/lib/fzf/shell/completion.zsh" \ - "/usr/local/share/fzf/examples/completion.zsh" \ - "/usr/share/doc/fzf/examples/completion.zsh" \ - "/opt/homebrew/opt/fzf/shell/completion.zsh" \ - && include_or "$ZDOTDIR/lib/fzf/shell/key-bindings.zsh" \ - "/usr/local/share/fzf/examples/key-bindings.zsh" \ - "/usr/share/doc/fzf/examples/key-bindings.zsh" \ - "/opt/homebrew/opt/fzf/shell/key-bindings.zsh" + include_first "$ZDOTDIR/lib/fzf/shell/completion.zsh" \ + "/usr/local/share/fzf/examples/completion.zsh" \ + "/usr/share/doc/fzf/examples/completion.zsh" \ + "/opt/homebrew/opt/fzf/shell/completion.zsh" \ + && include_first "$ZDOTDIR/lib/fzf/shell/key-bindings.zsh" \ + "/usr/local/share/fzf/examples/key-bindings.zsh" \ + "/usr/share/doc/fzf/examples/key-bindings.zsh" \ + "/opt/homebrew/opt/fzf/shell/key-bindings.zsh" fi # zsh autosuggestions -if include_or "$ZDOTDIR/zsh-autosuggestions/zsh-autosuggestions.zsh" \ - "/usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh" \ - "/usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh" \ - "/opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh"; then +if include_first "$ZDOTDIR/zsh-autosuggestions/zsh-autosuggestions.zsh" \ + "/usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh" \ + "/usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh" \ + "/opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh"; then ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20 ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(${ZSH_AUTOSUGGEST_ACCEPT_WIDGETS:#forward-char}) ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS+=(forward-char) @@ -582,17 +582,17 @@ fi include "$ZDOTDIR"/.zshrc.local # Also, we do zsh-syntax-highlighting here, because it needs to be at the end. -if include_or "$ZDOTDIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" \ - "/usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" \ - "/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" \ - "/opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"; then +if include_first "$ZDOTDIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" \ + "/usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" \ + "/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" \ + "/opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"; then ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets) ZSH_HIGHLIGHT_MAXLENGTH=1024 # don't colorize long command lines (slow) ZSH_HIGHLIGHT_STYLES+=(comment fg=96) # the default is hard to see fi # Unload some functions -unfunction include include_or +unfunction include include_first # END OF FILE ################################################################# |