From ceb8f4c9dfc5a0f60a20ed732d9f629589d30864 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Mon, 19 Apr 2021 11:32:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=BC=D0=B5=D0=BD=D0=B0=20antibody?= =?UTF-8?q?=20=D0=BD=D0=B0=20zplug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .zshrc | 2 ++ README.md | 17 +++++++++++++---- agents.zsh | 6 +++--- env.zsh | 1 + plugins.zsh | 49 +++++++++++++++++++++++++++++-------------------- prompt.zsh | 6 +++--- 6 files changed, 51 insertions(+), 30 deletions(-) diff --git a/.zshrc b/.zshrc index cdca142..ded8825 100644 --- a/.zshrc +++ b/.zshrc @@ -21,4 +21,6 @@ source $ZDOTDIR/prompt.zsh source $ZDOTDIR/aliases.zsh [ -e $ZDOTDIR/aliases.user.zsh ] && source $ZDOTDIR/aliases.user.zsh +zplug load + true diff --git a/README.md b/README.md index 5bc8ab6..9800f9a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Установка необходимых пакетов: ```sh -sudo apt-get install zsh antibody +sudo apt-get install zsh ``` Установка желательных пакетов: @@ -53,7 +53,7 @@ cp ~/.config/zsh/agents.zsh ~/.config/zsh/agents.user.zsh Раскомментировать в файле ` ~/.config/zsh/agents.user.zsh` строку: ```text -# antibody bundle ohmyzsh/ohmyzsh path:plugins/gpg-agent +# zplug "plugins/gpg-agent", from:oh-my-zsh ``` Пример файла настройки GPG агента `~/.config/gnupg/gpg-agent.conf`: @@ -80,7 +80,7 @@ pinentry-program /usr/bin/pinentry-qt # zstyle :omz:plugins:ssh-agent agent-forwarding on # zstyle :omz:plugins:ssh-agent identities id_rsa # zstyle :omz:plugins:ssh-agent lifetime 10h -# antibody bundle ohmyzsh/ohmyzsh path:plugins/ssh-agent +# zplug "plugins/ssh-agent", from:oh-my-zsh ``` Добавить в конец файла `~/.ssh/config` правило для разрешения агенту сохранять ключи: @@ -104,8 +104,17 @@ Host * # zstyle :omz:plugins:keychain identities id_rsa 01234567 # zstyle :omz:plugins:keychain options --quiet --inherit local-once --noask --nocolor --quick # zstyle :omz:plugins:keychain agents gpg,ssh -# antibody bundle ohmyzsh/ohmyzsh path:plugins/keychain +# zplug "plugins/keychain", from:oh-my-zsh ``` Отредактировать файлы настроек для агента GPG и SSH, как это описано в разделах выше. + +## Инициализация плагинов + +После редактирования файлов настройки запустить `zsh`, в результате чего будет +загружен менеджер пакетов `zplug`. Для загрузки пакетов выполнить команду: + +```sh +zplug install +``` diff --git a/agents.zsh b/agents.zsh index cc6a7bd..cf60fd7 100644 --- a/agents.zsh +++ b/agents.zsh @@ -6,12 +6,12 @@ # zstyle :omz:plugins:ssh-agent agent-forwarding on # zstyle :omz:plugins:ssh-agent identities id_rsa # zstyle :omz:plugins:ssh-agent lifetime 10h -# antibody bundle ohmyzsh/ohmyzsh path:plugins/ssh-agent +# zplug "plugins/ssh-agent", from:oh-my-zsh ## # GPG agent ## -# antibody bundle ohmyzsh/ohmyzsh path:plugins/gpg-agent +# zplug "plugins/gpg-agent", from:oh-my-zsh ## # Keychain @@ -19,5 +19,5 @@ # zstyle :omz:plugins:keychain identities id_rsa 01234567 # zstyle :omz:plugins:keychain options --quiet --inherit local-once --noask --nocolor --quick # zstyle :omz:plugins:keychain agents gpg,ssh -# antibody bundle ohmyzsh/ohmyzsh path:plugins/keychain +# zplug "plugins/keychain", from:oh-my-zsh diff --git a/env.zsh b/env.zsh index 5e18028..97baa54 100644 --- a/env.zsh +++ b/env.zsh @@ -2,6 +2,7 @@ export XDG_CONFIG_HOME=$HOME/.config export XDG_CACHE_HOME=$HOME/.cache export XDG_DATA_HOME=$HOME/.local/share +export ZPLUG_HOME=$XDG_CACHE_HOME/zplug export PATH=$HOME/bin:$HOME/.local/bin:$PATH # Удалить дубликаты в PATH diff --git a/plugins.zsh b/plugins.zsh index c7ca44d..45916b3 100644 --- a/plugins.zsh +++ b/plugins.zsh @@ -1,27 +1,35 @@ -# Менеджер плагинов antibody -source <(antibody init) +# Менеджер плагинов zplug +if [ ! -d $ZPLUG_HOME ]; then + git clone https://github.com/zplug/zplug $ZPLUG_HOME +fi + +source $ZPLUG_HOME/init.zsh # Плагины -antibody bundle zdharma/fast-syntax-highlighting -antibody bundle zsh-users/zsh-autosuggestions -antibody bundle zsh-users/zsh-history-substring-search -antibody bundle zsh-users/zsh-completions -antibody bundle rupa/z +zplug "zdharma/fast-syntax-highlighting", defer:2 + +# Make sure to use double quotes +zplug "zsh-users/zsh-history-substring-search" + +zplug "zsh-users/zsh-autosuggestions" +zplug "zsh-users/zsh-history-substring-search" +zplug "zsh-users/zsh-completions" +zplug "rupa/z" if [[ "$DISPLAY" != '' ]] && command -v xdotool > /dev/null 2>&1 && command -v wmctrl > /dev/null 2>&1; then - antibody bundle marzocchi/zsh-notify + zplug "marzocchi/zsh-notify" zstyle ':notify:*' expire-time 6000 zstyle ':notify:*' command-complete-timeout 20 fi if command -v peco > /dev/null 2>&1; then - antibody bundle jimeh/zsh-peco-history + zplug "jimeh/zsh-peco-history" fi -antibody bundle ohmyzsh/ohmyzsh path:plugins/command-not-found -antibody bundle ohmyzsh/ohmyzsh path:plugins/common-aliases -antibody bundle ohmyzsh/ohmyzsh path:plugins/debian +zplug "plugins/command-not-found", from:oh-my-zsh +zplug "plugins/common-aliases", from:oh-my-zsh +zplug "plugins/debian", from:oh-my-zsh if command -v fzf > /dev/null 2>&1; then export DISABLE_FZF_KEY_BINDINGS=true - antibody bundle ohmyzsh/ohmyzsh path:plugins/fzf + zplug "plugins/fzf", from:oh-my-zsh # fzf if [ -e /usr/share/doc/fzf/examples/key-bindings.zsh ]; then . /usr/share/doc/fzf/examples/key-bindings.zsh @@ -31,13 +39,14 @@ if command -v fzf > /dev/null 2>&1; then fi fi if command -v git > /dev/null 2>&1; then - antibody bundle ohmyzsh/ohmyzsh path:plugins/git + zplug "plugins/git", from:oh-my-zsh fi if command -v psql > /dev/null 2>&1; then - antibody bundle ohmyzsh/ohmyzsh path:plugins/postgres + zplug "plugins/postgres", from:oh-my-zsh fi -antibody bundle ohmyzsh/ohmyzsh path:plugins/sudo -antibody bundle ohmyzsh/ohmyzsh path:plugins/systemd -antibody bundle ohmyzsh/ohmyzsh path:plugins/vim-interaction -antibody bundle ohmyzsh/ohmyzsh path:plugins/web-search -antibody bundle djui/alias-tips +zplug "plugins/sudo", from:oh-my-zsh +zplug "plugins/systemd", from:oh-my-zsh +zplug "plugins/vim-interaction", from:oh-my-zsh +zplug "plugins/web-search", from:oh-my-zsh + +zplug "djui/alias-tips" diff --git a/prompt.zsh b/prompt.zsh index 914e41b..2a0ed4c 100644 --- a/prompt.zsh +++ b/prompt.zsh @@ -27,8 +27,8 @@ if [[ "$TERM_PROGRAM" == "Hyper" ]]; then SPACESHIP_GIT_BRANCH_SHOW=false fi -if $(is-at-least 5.2); then - antibody bundle denysdovhan/spaceship-prompt +if __zplug::base::base::zsh_version 5.2; then + zplug "denysdovhan/spaceship-prompt" else - antibody bundle nojhan/liquidprompt + zplug "nojhan/liquidprompt" fi