aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2018-02-08 13:06:58 +0100
committerDavid Runge <dave@sleepmap.de>2018-02-08 13:06:58 +0100
commitb647fdba3884ae0466cbe4b14d72b49779ffb30b (patch)
tree26e8f6b22e7686e1b5254d27c4643a903657a170
parent669ada27d4fe46453beadec916c59cb543c227b0 (diff)
downloaddotfiles-b647fdba3884ae0466cbe4b14d72b49779ffb30b.tar.gz
dotfiles-b647fdba3884ae0466cbe4b14d72b49779ffb30b.tar.bz2
dotfiles-b647fdba3884ae0466cbe4b14d72b49779ffb30b.tar.xz
dotfiles-b647fdba3884ae0466cbe4b14d72b49779ffb30b.zip
.zshrc: Fix usage of zsh extensions on other systems or when those extensions are not around.
-rw-r--r--.zshrc43
1 files changed, 30 insertions, 13 deletions
diff --git a/.zshrc b/.zshrc
index 4d500ec..b03cacb 100644
--- a/.zshrc
+++ b/.zshrc
@@ -391,20 +391,37 @@ zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^(<->.<-
# syntax-highlighting
-source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
-
-# history-substring-search
-source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
-# Vi
-bindkey -M vicmd "k" history-substring-search-up
-bindkey -M vicmd "j" history-substring-search-down
-
-# Emacs and Vi
-for keymap in 'viins'; do
- bindkey -M "$keymap" "$key_info[Up]" history-substring-search-up
- bindkey -M "$keymap" "$key_info[Down]" history-substring-search-down
-done
+if [ -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then
+ source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
+elif [ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then
+ source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
+fi
+if [ -f /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh ]; then
+ # history-substring-search
+ source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
+ # Vi
+ bindkey -M vicmd "k" history-substring-search-up
+ bindkey -M vicmd "j" history-substring-search-down
+
+ # Emacs and Vi
+ for keymap in 'viins'; do
+ bindkey -M "$keymap" "$key_info[Up]" history-substring-search-up
+ bindkey -M "$keymap" "$key_info[Down]" history-substring-search-down
+ done
+elif [ -f /usr/share/zsh-history-substring-search/zsh-history-substring-search.zsh ]; then
+ # history-substring-search
+ source /usr/share/zsh-history-substring-search/zsh-history-substring-search.zsh
+ # Vi
+ bindkey -M vicmd "k" history-substring-search-up
+ bindkey -M vicmd "j" history-substring-search-down
+
+ # Emacs and Vi
+ for keymap in 'viins'; do
+ bindkey -M "$keymap" "$key_info[Up]" history-substring-search-up
+ bindkey -M "$keymap" "$key_info[Down]" history-substring-search-down
+ done
+fi
# zsh.after
#