From a14512b585350405df75dd6a79c3f3d5e476fb26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Mon, 22 Apr 2019 20:37:23 +0200 Subject: [PATCH] ZSH compatible with root --- config/shell/zshrc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/config/shell/zshrc b/config/shell/zshrc index eedb84b..df47943 100644 --- a/config/shell/zshrc +++ b/config/shell/zshrc @@ -16,10 +16,22 @@ mkdir -p $ADOTDIR typeset -a ANTIGEN_CHECK_FILES=(~/.config/shell/zshrc) source ~/.local/share/zsh/antigen.zsh # Don't work with trysource, why? -antigen bundle zsh-users/zsh-completions -antigen bundle zsh-users/zsh-syntax-highlighting -antigen bundle zsh-users/zsh-autosuggestions -antigen bundle zsh-users/zsh-history-substring-search + +# This is better to have them installed as system since we can use them as root +# pacman -S zsh-autosuggestions zsh-history-substring-search zsh-syntax-highlighting zsh-completions --needed +function plugin() { + if [ -d "/usr/share/licenses/$2" ] + then + trysource "/usr/share/zsh/plugins/$2/$2.zsh" + # It's ok if it fails + else + antigen bundle "$1/$2" + fi +} +plugin zsh-users zsh-completions +plugin zsh-users zsh-syntax-highlighting +plugin zsh-users zsh-autosuggestions +plugin zsh-users zsh-history-substring-search antigen apply @@ -111,8 +123,7 @@ bindkey -M vicmd 'k' history-substring-search-up bindkey -M vicmd 'j' history-substring-search-down # Autocompletion -autoload -Uz compinit promptinit -compinit +autoload -Uz promptinit promptinit # Color common prefix