diff options
author | David Runge <david.runge@native-instruments.de> | 2018-04-23 08:33:41 +0200 |
---|---|---|
committer | David Runge <david.runge@native-instruments.de> | 2018-04-23 08:33:41 +0200 |
commit | 321047fd2d6da1c3b3260e2a89d1e6c2377cb534 (patch) | |
tree | ae062db7c1341ea5f5087b0c5b719278e1cdadcb | |
parent | 7ee52196362d67b2da95baa345b85a34ce149379 (diff) | |
download | dotfiles-321047fd2d6da1c3b3260e2a89d1e6c2377cb534.tar.gz dotfiles-321047fd2d6da1c3b3260e2a89d1e6c2377cb534.tar.bz2 dotfiles-321047fd2d6da1c3b3260e2a89d1e6c2377cb534.tar.xz dotfiles-321047fd2d6da1c3b3260e2a89d1e6c2377cb534.zip |
.zshrc: Adding automatic sourcing of zsh-{autosuggestions,syntax-highlighting,history-substring-search} for various Linuxes and macOS.
Expects the extensions to be installed with a package manager on the system.
-rw-r--r-- | .zshrc | 65 |
1 files changed, 35 insertions, 30 deletions
@@ -389,39 +389,44 @@ zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*(.|:)*' l zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^[-[:alnum:]]##(.[-[:alnum:]]##)##' '*@*' zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^(<->.<->.<->.<->|(|::)([[:xdigit:].]##:(#c,2))##(|%*))' '127.0.0.<->' '255.255.255.255' '::1' 'fe80::*' +# autosuggestions +autosuggestions=( "/usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" + "/usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh" + "/usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh" ) +for p in ${autosuggestions}; do + if [ -f "$p" ]; then + source "$p" + fi +done # syntax-highlighting -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 +syntax_highlighting=( "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" + "/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" + "/usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ) +for p in ${syntax_highlighting}; do + if [ -f "$p" ]; then + source "$p" + fi +done -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 +# history-substring-search +history_substring=( "/usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh" + "/usr/share/zsh-history-substring-search/zsh-history-substring-search.zsh" + "/usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh" ) +for p in ${history_substring}; do + if [ -f "$p" ]; then + source "$p" + # 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 +done # zsh.after # |