From 86f8470be0ba1846af4c46e59e57bac451690c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20P=C5=82azie=C5=84ski?= Date: Sun, 8 Sep 2024 12:55:43 +0200 Subject: [PATCH] Use zplug to manage local plugins --- zsh.d/50_zplug.zsh | 26 -------------------------- zshrc | 43 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 30 deletions(-) delete mode 100644 zsh.d/50_zplug.zsh diff --git a/zsh.d/50_zplug.zsh b/zsh.d/50_zplug.zsh deleted file mode 100644 index 99d39a5..0000000 --- a/zsh.d/50_zplug.zsh +++ /dev/null @@ -1,26 +0,0 @@ -# vim: ft=zsh - -export ZPLUG_ROOT=${ZPLUG_ROOT:-/usr/share/zplug} - -if [[ ! -f "${ZPLUG_ROOT}/init.zsh" ]]; then - return -fi - -source ${ZPLUG_ROOT}/init.zsh -zplug "plugins/git", from:oh-my-zsh -zplug "plugins/sudo", from:oh-my-zsh -zplug "plugins/command-not-found", from:oh-my-zsh -zplug "zsh-users/zsh-syntax-highlighting" -zplug "zsh-users/zsh-autosuggestions" -zplug "zsh-users/zsh-history-substring-search" -zplug "zsh-users/zsh-completions" -zplug "junegunn/fzf", use:"shell/*.zsh" - -if ! zplug check --verbose; then - printf "Install? [y/N]: " - if read -q; then - echo - zplug install - fi -fi -zplug load diff --git a/zshrc b/zshrc index 8eb1b7c..0c688bd 100644 --- a/zshrc +++ b/zshrc @@ -263,8 +263,43 @@ precmd_functions=(store_last_return_value $precmd_functions) zmodload zsh/complist -#---------------------------------- Partials ------------------------------------ +#---------------------------------- Plugins ------------------------------------ + +export ZPLUG_ROOT=${ZPLUG_ROOT:-$ZDOTDIR/zplug} +export ZPLUG_VERSION=${ZPLUG_VERSION:-2.4.2} + +if [[ ! -d "$ZPLUG_ROOT" ]]; then + ZPLUG_PARENT=$(dirname "$ZPLUG_ROOT") + if [[ ! -w "$ZPLUG_PARENT" ]]; then + echo "ZPLUG_ROOT, which is $ZPLUG_ROOT doesn't exists and cannot be created" >&2 + return + fi + printf "zplug not installed, clone to ${ZPLUG_ROOT}? [y/N]: " + if read -q; then + echo + git clone https://github.com/zplug/zplug -b "$ZPLUG_VERSION" $ZPLUG_ROOT + fi +fi + +source ${ZPLUG_ROOT}/init.zsh + +zplug "plugins/git", from:oh-my-zsh +zplug "plugins/sudo", from:oh-my-zsh +zplug "plugins/command-not-found", from:oh-my-zsh +zplug "zsh-users/zsh-syntax-highlighting" +zplug "zsh-users/zsh-autosuggestions" +zplug "zsh-users/zsh-history-substring-search" +zplug "zsh-users/zsh-completions" +zplug "junegunn/fzf", use:"shell/*.zsh" + +zplug "$ZDOTDIR/zsh.d", from:local + +if ! zplug check --verbose; then + printf "Install? [y/N]: " + if read -q; then + echo + zplug install + fi +fi +zplug load -for partial in ${ZDOTDIR}/zsh.d/*.zsh; do - source $partial -done