From d868d4f8aedcd341fbf56d1c79d646e101f6c007 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Thu, 22 Jul 2021 09:19:16 +0300 Subject: [PATCH 01/11] =?UTF-8?q?=D0=9A=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4?= =?UTF-8?q?=D1=8B=20=D0=B4=D0=BB=D1=8F=20apt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aliases.zsh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aliases.zsh b/aliases.zsh index 4f07a93..f56b6f1 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -13,7 +13,8 @@ alias aptp='sudo apt-get purge' alias aptr='sudo apt-get remove' alias aptc='sudo apt-get --purge autoremove' alias aptk='sudo apt-key add' -apts() { +alias apts='apt-cache show' +aptf() { [ -z $1 ] && return 1 if [ -z $2 ]; then apt-cache search $1 @@ -21,6 +22,11 @@ apts() { apt-cache search $1 | grep $2 fi } +aptl() { + [ -z $1 ] && return 1 + sudo apt-get purge linux-modules-extra-"$1".* linux-modules-"$1".* linux-tools-"$1".* \ + linux-image-"$1".* linux-image-unsigned-"$1".* linux-headers-"$1".* +} # VIM alias gvim='gvim --remote-silent' From c49d89dc1a6d6537cded1d0a877bbc4e739819e7 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Mon, 2 Aug 2021 11:23:43 +0300 Subject: [PATCH 02/11] =?UTF-8?q?=D0=A3=D1=81=D1=82=D0=B0=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20git=20=D0=B8=20ssh-askpass?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 448c3d8..726a289 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ sudo apt-get install zsh Установка желательных пакетов: ```sh -sudo apt-get install keychain peco fzf wmctrl xdotool autojump +sudo apt-get install keychain peco fzf wmctrl xdotool autojump git ssh-askpass ``` Клонирование репозитория в каталог `~/.config/zsh`: From a040a92a2d896f0980be0b80201566a5f960f606 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Mon, 9 Aug 2021 09:12:07 +0300 Subject: [PATCH 03/11] =?UTF-8?q?=D0=9D=D0=B5=20=D0=B7=D0=B0=D0=BF=D1=83?= =?UTF-8?q?=D1=81=D0=BA=D0=B0=D1=82=D1=8C=20tmux=20=D0=B0=D0=B2=D1=82?= =?UTF-8?q?=D0=BE=D0=BC=D0=B0=D1=82=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins.zsh b/plugins.zsh index e85e323..5aa4be1 100644 --- a/plugins.zsh +++ b/plugins.zsh @@ -64,7 +64,7 @@ zinit snippet OMZP::web-search zinit load djui/alias-tips zstyle ':prezto:module:tmux:auto-start' local 'no' -zstyle ':prezto:module:tmux:auto-start' remote 'yes' +zstyle ':prezto:module:tmux:auto-start' remote 'no' zstyle ':prezto:module:tmux:session' name "$(hostname)" zinit snippet PZTM::tmux From 098834c637f8856cd3d58033f35f915d33c52719 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Mon, 9 Aug 2021 15:50:23 +0300 Subject: [PATCH 04/11] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins.zsh b/plugins.zsh index 5aa4be1..94b5b25 100644 --- a/plugins.zsh +++ b/plugins.zsh @@ -19,6 +19,7 @@ if [[ "$DISPLAY" != '' ]] && command -v xdotool > /dev/null 2>&1 && command -v zstyle ':notify:*' expire-time 5000 zstyle ':notify:*' command-complete-timeout 20 zstyle ':notify:*' enable-on-ssh yes + zstyle ':notify:*' always-check-active-window yes fi if command -v peco > /dev/null 2>&1; then zinit load jimeh/zsh-peco-history From e9b976f5f23bded8fd2fd83c09e499f674ff6d53 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Wed, 8 Sep 2021 09:43:54 +0300 Subject: [PATCH 05/11] =?UTF-8?q?=D0=A1=D0=BF=D0=B8=D1=81=D0=BE=D0=BA=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B6=D0=B0=D0=B5=D0=BC=D1=8B?= =?UTF-8?q?=D1=85=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .zshrc | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/.zshrc b/.zshrc index cd5bfb3..e5ef844 100644 --- a/.zshrc +++ b/.zshrc @@ -1,27 +1,32 @@ -[ -e $ZDOTDIR/env.start.zsh ] && source $ZDOTDIR/env.start.zsh +zmodload zsh/zprof -source $ZDOTDIR/env.zsh -[ -e $ZDOTDIR/env.user.zsh ] && source $ZDOTDIR/env.user.zsh - -source $ZDOTDIR/history.zsh -[ -e $ZDOTDIR/history.user.zsh ] && source $ZDOTDIR/history.user.zsh - -source $ZDOTDIR/options.zsh -[ -e $ZDOTDIR/options.user.zsh ] && source $ZDOTDIR/options.user.zsh - -source $ZDOTDIR/plugins.zsh -[ -e $ZDOTDIR/plugins.user.zsh ] && source $ZDOTDIR/plugins.user.zsh - -source $ZDOTDIR/agents.zsh -[ -e $ZDOTDIR/agents.user.zsh ] && source $ZDOTDIR/agents.user.zsh - -source $ZDOTDIR/prompt.zsh -[ -e $ZDOTDIR/prompt.user.zsh ] && source $ZDOTDIR/prompt.user.zsh - -source $ZDOTDIR/aliases.zsh -[ -e $ZDOTDIR/aliases.user.zsh ] && source $ZDOTDIR/aliases.user.zsh - -source $ZDOTDIR/compinit.zsh -[ -e $ZDOTDIR/compinit.user.zsh ] && source $ZDOTDIR/compinit.user.zsh +for S in \ + "$ZDOTDIR/env.start.zsh" \ + "$ZDOTDIR/env.zsh" \ + "$ZDOTDIR/env.user.zsh" \ + \ + "$ZDOTDIR/history.zsh" \ + "$ZDOTDIR/history.user.zsh" \ + \ + "$ZDOTDIR/options.zsh" \ + "$ZDOTDIR/options.user.zsh" \ + \ + "$ZDOTDIR/plugins.zsh" \ + "$ZDOTDIR/plugins.user.zsh" \ + \ + "$ZDOTDIR/agents.zsh" \ + "$ZDOTDIR/agents.user.zsh" \ + \ + "$ZDOTDIR/prompt.zsh" \ + "$ZDOTDIR/prompt.user.zsh" \ + \ + "$ZDOTDIR/aliases.zsh" \ + "$ZDOTDIR/aliases.user.zsh" \ + \ + "$ZDOTDIR/compinit.zsh" \ + "$ZDOTDIR/compinit.user.zsh" \ + ; + do [ -e "$S" ] && source "$S" +done true From 00bd63ccc6e6b22e8dee71ef9ec2ad0089421f44 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Sat, 6 Nov 2021 19:50:38 +0300 Subject: [PATCH 06/11] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=20=D0=BD=D0=B0=20=D0=BC=D0=B5=D0=BD=D0=B5=D0=B4=D0=B6?= =?UTF-8?q?=D0=B5=D1=80=20https://github.com/jandamm/zgenom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .zshrc | 42 +++++++-------------- env.zsh => 15-env.zsh | 35 +++++++++++------ history.zsh => 25-history.zsh | 5 +-- options.zsh => 35-options.zsh | 9 ++++- 45-plugins.zsh | 66 ++++++++++++++++++++++++++++++++ agents.zsh => 55-agents.zsh | 7 ++-- prompt.zsh => 65-prompt.zsh | 4 +- aliases.zsh => 75-aliases.zsh | 12 +----- 78-scripts.zsh | 57 ++++++++++++++++++++++++++++ 85-compinit.zsh | 42 +++++++++++++++++++++ 95-finish.zsh | 3 ++ README.md | 19 +++++----- compinit.zsh | 27 ------------- plugins.zsh | 71 ----------------------------------- 14 files changed, 230 insertions(+), 169 deletions(-) rename env.zsh => 15-env.zsh (50%) rename history.zsh => 25-history.zsh (92%) rename options.zsh => 35-options.zsh (56%) create mode 100644 45-plugins.zsh rename agents.zsh => 55-agents.zsh (77%) rename prompt.zsh => 65-prompt.zsh (91%) rename aliases.zsh => 75-aliases.zsh (78%) create mode 100644 78-scripts.zsh create mode 100644 85-compinit.zsh create mode 100644 95-finish.zsh delete mode 100644 compinit.zsh delete mode 100644 plugins.zsh diff --git a/.zshrc b/.zshrc index e5ef844..be73f87 100644 --- a/.zshrc +++ b/.zshrc @@ -1,32 +1,18 @@ -zmodload zsh/zprof - for S in \ - "$ZDOTDIR/env.start.zsh" \ - "$ZDOTDIR/env.zsh" \ - "$ZDOTDIR/env.user.zsh" \ - \ - "$ZDOTDIR/history.zsh" \ - "$ZDOTDIR/history.user.zsh" \ - \ - "$ZDOTDIR/options.zsh" \ - "$ZDOTDIR/options.user.zsh" \ - \ - "$ZDOTDIR/plugins.zsh" \ - "$ZDOTDIR/plugins.user.zsh" \ - \ - "$ZDOTDIR/agents.zsh" \ - "$ZDOTDIR/agents.user.zsh" \ - \ - "$ZDOTDIR/prompt.zsh" \ - "$ZDOTDIR/prompt.user.zsh" \ - \ - "$ZDOTDIR/aliases.zsh" \ - "$ZDOTDIR/aliases.user.zsh" \ - \ - "$ZDOTDIR/compinit.zsh" \ - "$ZDOTDIR/compinit.user.zsh" \ - ; - do [ -e "$S" ] && source "$S" + 05-start \ + 15-env \ + 25-history \ + 35-options \ + 45-plugins \ + 55-agents \ + 65-prompt \ + 75-aliases \ + 78-scripts \ + 85-compinit \ + 95-finish +do + [ -e "$ZDOTDIR/$S.zsh" ] && source "$ZDOTDIR/$S.zsh" + [ -e "$ZDOTDIR/$S.user.zsh" ] && source "$ZDOTDIR/$S.user.zsh" done true diff --git a/env.zsh b/15-env.zsh similarity index 50% rename from env.zsh rename to 15-env.zsh index 0cdfa9a..26cdb1b 100644 --- a/env.zsh +++ b/15-env.zsh @@ -1,21 +1,32 @@ -export XDG_CONFIG_HOME=$HOME/.config -export XDG_CACHE_HOME=$HOME/.cache -export XDG_DATA_HOME=$HOME/.local/share +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_DATA_HOME="$HOME/.local/share" -declare -A ZINIT -ZINIT[HOME_DIR]=$XDG_CACHE_HOME/zsh/zinit -ZINIT[PLUGINS_DIR]=$XDG_CACHE_HOME/zsh/plugins -ZINIT[SNIPPETS_DIR]=$XDG_CACHE_HOME/zsh/snippets -ZINIT[ZCOMPDUMP_PATH]=$XDG_CACHE_HOME/zsh/zcompdump +export ZSH_CACHE_DIR="$XDG_CACHE_HOME/zsh" +export ZSH_COMPDUMP="$ZSH_CACHE_DIR/completions/dump" +export ZGEN_SOURCE="$ZSH_CACHE_DIR" +export ZGEN_SOURCE_BIN="$ZSH_CACHE_DIR/plugins" +export ZGEN_DIR="$ZSH_CACHE_DIR/zgenom" +ZPFX=$ZGEN_DIR/polaris -ZPFX=$XDG_CACHE_HOME/zsh/polaris +DISABLE_AUTO_UPDATE=true + +# PATH +for P in \ + "$HOME/.vim/plugged/vim-superman/bin" \ + "$HOME/bin" \ + "$HOME/.local/bin" +do + if [[ -d "${P}" ]]; then + export PATH="${P}:${PATH}" + fi +done -export PATH=$HOME/bin:$HOME/.local/bin:$PATH # Удалить дубликаты в PATH typeset -U PATH -export GNUPGHOME=$HOME/.config/gnupg -export SVDIR=$HOME/sv +export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" +export SVDIR="$HOME/sv" # Настройка uncrustify UNCRUSTIFY_CONFIG="${XDG_CONFIG_HOME}/uncrustify/default.cfg" diff --git a/history.zsh b/25-history.zsh similarity index 92% rename from history.zsh rename to 25-history.zsh index eb4bb7c..6736b04 100644 --- a/history.zsh +++ b/25-history.zsh @@ -1,9 +1,9 @@ -HISTFILE="$HOME/.cache/zsh/history" +HISTFILE="$ZSH_CACHE_DIR/history" HISTSIZE=10000000 SAVEHIST=10000000 HISTDUP=erase -[ ! -d "$HOME/.cache/zsh" ] && mkdir -p "$HOME/.cache/zsh" +[ ! -d "$ZSH_CACHE_DIR" ] && mkdir -p "$ZSH_CACHE_DIR" setopt BANG_HIST # Treat the '!' character specially during expansion. setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format. @@ -19,4 +19,3 @@ setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording en setopt HIST_VERIFY # Don't execute immediately upon history expansion. setopt HIST_BEEP # Beep when accessing nonexistent history. - diff --git a/options.zsh b/35-options.zsh similarity index 56% rename from options.zsh rename to 35-options.zsh index 30680e3..9e332c9 100644 --- a/options.zsh +++ b/35-options.zsh @@ -2,15 +2,22 @@ # apt-get install autojump [[ -s /usr/share/autojump/autojump.sh ]] && source /usr/share/autojump/autojump.sh +setopt AUTO_PUSHD # Push the current directory visited on the stack. +setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack. +setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd. + autoload -Uz allopt zed zmv zcalc colors colors +zmodload zsh/terminfo + autoload -Uz edit-command-line zle -N edit-command-line -#bindkey -M vicmd v edit-command-line +bindkey -M vicmd v edit-command-line autoload -Uz select-word-style select-word-style shell autoload -Uz url-quote-magic zle -N self-insert url-quote-magic + diff --git a/45-plugins.zsh b/45-plugins.zsh new file mode 100644 index 0000000..af221ad --- /dev/null +++ b/45-plugins.zsh @@ -0,0 +1,66 @@ +# Менеджер плагинов zgenom +if [ ! -e "$ZGEN_DIR/zgenom.zsh" ]; then + git clone https://github.com/jandamm/zgenom "$ZGEN_DIR" +fi + +source "$ZGEN_DIR/zgenom.zsh" + +# +# Ohmyzsh +# +zgenom ohmyzsh + +# Плагины +zgenom load willghatch/zsh-saneopt +zgenom load mafredri/zsh-async +zgenom load djui/alias-tips + +zgenom load rupa/z +if [[ "$DISPLAY" != '' ]] && command -v xdotool > /dev/null 2>&1 && command -v wmctrl > /dev/null 2>&1; then + zgenom load marzocchi/zsh-notify + zstyle ':notify:*' expire-time 5000 + zstyle ':notify:*' command-complete-timeout 20 + zstyle ':notify:*' enable-on-ssh yes +fi +if command -v peco > /dev/null 2>&1; then + zgenom load jimeh/zsh-peco-history +fi + +zgenom ohmyzsh plugins/command-not-found +zgenom ohmyzsh plugins/systemadmin +zgenom ohmyzsh plugins/common-aliases +zgenom ohmyzsh plugins/debian +if command -v fzf > /dev/null 2>&1; then + export DISABLE_FZF_KEY_BINDINGS=true + zgenom ohmyzsh plugins/fzf + # fzf + [ -e /usr/share/doc/fzf/examples/key-bindings.zsh ] && source /usr/share/doc/fzf/examples/key-bindings.zsh + [ -e /usr/share/doc/fzf/examples/completion.zsh ] && source /usr/share/doc/fzf/examples/completion.zsh +fi +if command -v git > /dev/null 2>&1; then + zgenom ohmyzsh plugins/git + zgenom ohmyzsh plugins/git-auto-fetch + zgenom ohmyzsh plugins/git-extras + zgenom ohmyzsh plugins/github + zgenom load paulirish/git-open +fi +if command -v psql > /dev/null 2>&1; then + zgenom ohmyzsh plugins/postgres +fi +if command -v sudo > /dev/null 2>&1; then + zgenom ohmyzsh plugins/sudo +fi +if command -v systemctl > /dev/null 2>&1; then + zgenom ohmyzsh plugins/systemd +fi +if command -v vim > /dev/null 2>&1; then + zgenom ohmyzsh plugins/vim-interaction +fi +zgenom ohmyzsh plugins/web-search + +zgenom ohmyzsh plugins/tmux +zstyle ':prezto:module:tmux:auto-start' local 'no' +zstyle ':prezto:module:tmux:auto-start' remote 'yes' +zstyle ':prezto:module:tmux:session' name "$(hostname)" +zgenom load laggardkernel/zsh-tmux + diff --git a/agents.zsh b/55-agents.zsh similarity index 77% rename from agents.zsh rename to 55-agents.zsh index e3fd536..8e5111c 100644 --- a/agents.zsh +++ b/55-agents.zsh @@ -6,13 +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 -# zinit snippet OMZP::ssh-agent +# zgenom ohmyzsh plugins/ssh-agent ## # GPG agent ## -# zinit ice wait'1' lucid -# zinit light laggardkernel/zsh-gpg-agent +# zgenom ohmyzsh plugins/gpg-agent ## # Keychain @@ -20,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 -# zinit snippet OMZP::keychain +# zgenom ohmyzsh plugins/keychain diff --git a/prompt.zsh b/65-prompt.zsh similarity index 91% rename from prompt.zsh rename to 65-prompt.zsh index ac2f838..2b46db3 100644 --- a/prompt.zsh +++ b/65-prompt.zsh @@ -29,7 +29,7 @@ fi autoload is-at-least if is-at-least "5.2" "$ZSH_VERSION"; then - zinit load "denysdovhan/spaceship-prompt" + zgenom load "denysdovhan/spaceship-prompt" else - zinit load "nojhan/liquidprompt" + zgenom load "nojhan/liquidprompt" fi diff --git a/aliases.zsh b/75-aliases.zsh similarity index 78% rename from aliases.zsh rename to 75-aliases.zsh index f56b6f1..a2619a4 100644 --- a/aliases.zsh +++ b/75-aliases.zsh @@ -22,14 +22,6 @@ aptf() { apt-cache search $1 | grep $2 fi } -aptl() { - [ -z $1 ] && return 1 - sudo apt-get purge linux-modules-extra-"$1".* linux-modules-"$1".* linux-tools-"$1".* \ - linux-image-"$1".* linux-image-unsigned-"$1".* linux-headers-"$1".* -} - -# VIM -alias gvim='gvim --remote-silent' # Youtube YDL="$HOME/bin/youtube-dl" @@ -49,8 +41,6 @@ alias gur="git pull --recurse-submodules" alias gsui="git submodule update --recursive --init" alias gsur="git submodule update --recursive --init --remote" -# Фильтры -alias -g G="| grep" -alias -g L="| less" +# Фильтры (H,T,G,L определены в common-aliases) alias -g NN='&>/dev/null' diff --git a/78-scripts.zsh b/78-scripts.zsh new file mode 100644 index 0000000..7826074 --- /dev/null +++ b/78-scripts.zsh @@ -0,0 +1,57 @@ +ch() { + curl -s "https://cheat.sh/$1" | less +} + +exf() { + case "$1" in + *.tar.bz2) tar xjf "$1" ;; + *.tar.gz) tar xzf "$1" ;; + *.tar.xz) tar xJf "$1" ;; + *.tbz2) tar xjf "$1" ;; + *.tgz) tar xzf "$1" ;; + *.tar) tar xf "$1" ;; + *.zip) unzip "$1" ;; + *.7z) 7z x "$1" ;; + *.iso) 7z x "$1" ;; + *.rar) unrar x "$1" ;; + *) echo "'$1' cannot be extracted" ;; + esac +} + +exfl() { + for F in "$@" + do + if [ -f "$F" ]; then + exf "$F" + else + echo "'$F' is not a valid file" + fi + done +} + +exd() { + case "$1" in + *.tar.bz2) b=${1%.tar.bz2}; mkdir -p "$b">/dev/null; tar xjf "$1" -C "$b" ;; + *.tar.gz) b=${1%.tar.gz}; mkdir -p "$b">/dev/null; tar xzf "$1" -C "$b" ;; + *.tar.xz) b=${1%.tar.xz}; mkdir -p "$b">/dev/null; tar xJf "$1" -C "$b" ;; + *.tbz2) b=${1%.tbz2}; mkdir -p "$b">/dev/null; tar xjf "$1" -C "$b" ;; + *.tgz) b=${1%.tgz}; mkdir -p "$b">/dev/null; tar xzf "$1" -C "$b" ;; + *.tar) b=${1%.tar}; mkdir -p "$b">/dev/null; tar xf "$1" -C "$b" ;; + *.zip) b=${1%.zip}; unzip "$1" -d "$b" ;; + *.7z) b=${1%.7z}; 7z x -o"$b" "$1" ;; + *.iso) b=${1%.iso}; 7z x -o"$b" "$1" ;; + *.rar) b=${1%.rar}; rar x "$1" "$b" ;; + *) echo "'$1' cannot be extracted" ;; + esac +} + +exdl() { + for F in "$@" + do + if [ -f "$F" ]; then + exd "$F" + else + echo "'$F' is not a valid file" + fi + done +} diff --git a/85-compinit.zsh b/85-compinit.zsh new file mode 100644 index 0000000..0a8a055 --- /dev/null +++ b/85-compinit.zsh @@ -0,0 +1,42 @@ +typeset -i _compinit_updated_at=$(date +'%j' -r $ZSH_COMPDUMP 2>/dev/null || stat -f '%Sm' -t '%j' $ZSH_COMPDUMP 2>/dev/null) +ZGEN_COMPINIT_FLAGS="-i" +if [ $(date +'%j') = $_compinit_updated_at ]; then + ZGEN_COMPINIT_FLAGS+=" -C" +fi +unset _compinit_updated_at + +zmodload -i zsh/complist +autoload -Uz compinit && eval "compinit $ZGEN_COMPINIT_FLAGS -d $ZSH_COMPDUMP" + +#zgenom load marlonrichert/zsh-autocomplete +zgenom load zsh-users/zsh-autosuggestions + +# Speed up autocomplete, force prefix mapping +zstyle ':completion:*' accept-exact '*(N)' +zstyle ':completion:*' use-cache on +zstyle ':completion:*' cache-path $ZSH_CACHE_DIR/completion + +zstyle ':completion:*:processes' command 'ps -ax' +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;32' +zstyle ':completion:*:*:kill:*' menu yes select +zstyle ':completion:*:*:kill:*' force-list always +zstyle ':completion:*:*:kill:*' insert-ids single + +zstyle ':completion:*:processes-names' command 'ps -e -o comm=' +zstyle ':completion:*:*:killall:*' menu yes select +zstyle ':completion:*:killall:*' force-list always + +# SSH/SCP/RSYNC +zstyle ':completion:*:(ssh|scp|rsync):*' hosts off +zstyle ':completion:*:(scp|rsync):*' tag-order 'hosts:-host hosts:-domain:domain hosts:-ipaddr:ip\ address *' +zstyle ':completion:*:(scp|rsync):*' group-order users files all-files hosts-domain hosts-host hosts-ipaddr +zstyle ':completion:*:ssh:*' tag-order users 'hosts:-host hosts:-domain:domain hosts:-ipaddr:ip\ address *' +zstyle ':completion:*:ssh:*' group-order hosts-domain hosts-host users hosts-ipaddr +zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*.*' loopback localhost +zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^*.*' '*@*' +zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^<->.<->.<->.<->' '127.0.0.<->' + +# Вызов в этом месте и в таком порядке +zgenom load zsh-users/zsh-syntax-highlighting +zgenom load zsh-users/zsh-history-substring-search + diff --git a/95-finish.zsh b/95-finish.zsh new file mode 100644 index 0000000..6e9d3b6 --- /dev/null +++ b/95-finish.zsh @@ -0,0 +1,3 @@ +#zgenom save 2>/dev/null +#zgenom compile $ZDOTDIR + diff --git a/README.md b/README.md index 726a289..b7070de 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ sudo apt-get install zsh Установка желательных пакетов: ```sh -sudo apt-get install keychain peco fzf wmctrl xdotool autojump git ssh-askpass +sudo apt-get install keychain peco fzf wmctrl xdotool autojump ``` Клонирование репозитория в каталог `~/.config/zsh`: @@ -30,7 +30,7 @@ sudo ${EDITOR:-mcedit} /etc/zsh/zshenv и добавить строку ```sh -export ZDOTDIR=$HOME/.config/zsh +[[ -z "$ZDOTDIR" ]] && export ZDOTDIR=$HOME/.config/zsh ``` Установить интерпретатор Zsh по умолчанию для пользователя `username`. @@ -45,7 +45,7 @@ sudo usermod -s /usr/bin/zsh username Для любого из вариантов следует скопировать шаблонный файл для настроек: ```sh -cp ~/.config/zsh/agents.zsh ~/.config/zsh/agents.user.zsh +cp ~/.config/zsh/55-agents.zsh ~/.config/zsh/55-agents.user.zsh ``` ## Настройка GPG агента @@ -53,8 +53,7 @@ cp ~/.config/zsh/agents.zsh ~/.config/zsh/agents.user.zsh Раскомментировать в файле ` ~/.config/zsh/agents.user.zsh` строки: ```text -# zinit ice wait'1' lucid -# zinit light laggardkernel/zsh-gpg-agent +# zgenom ohmyzsh plugins/gpg-agent ``` Пример файла настройки GPG агента `~/.config/gnupg/gpg-agent.conf`: @@ -81,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 -# zinit snippet OMZP::ssh-agent +# zgenom ohmyzsh plugins/ssh-agent ``` Добавить в конец файла `~/.ssh/config` правило для разрешения агенту сохранять ключи: @@ -105,7 +104,7 @@ 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 -# zinit snippet OMZP::keychain +# zgenom ohmyzsh plugins/keychain ``` Отредактировать файлы настроек для агента GPG и SSH, как это описано в разделах выше. @@ -114,7 +113,7 @@ Host * ## Инициализация После редактирования файлов настройки запустить `zsh`, в результате чего будет -загружен менеджер пакетов `zinit` и необходимые плагины. +загружен менеджер пакетов `zgenom` и необходимые плагины. ## Обновление @@ -122,11 +121,11 @@ Host * Обновление менеджера пакетов: ```sh -zinit self-update +zgenom selfupdate ```` Обновление плагинов: ```sh -zinit update --parallel +zgenom update ``` diff --git a/compinit.zsh b/compinit.zsh deleted file mode 100644 index 39e38fc..0000000 --- a/compinit.zsh +++ /dev/null @@ -1,27 +0,0 @@ -typeset -i _compinit_updated_at=$(date +'%j' -r $ZINIT[ZCOMPDUMP_PATH] 2>/dev/null || stat -f '%Sm' -t '%j' $ZINIT[ZCOMPDUMP_PATH] 2>/dev/null) -if [ $(date +'%j') != $_compinit_updated_at ]; then - ZINIT[COMPINIT_OPTS]="-i" -else - ZINIT[COMPINIT_OPTS]="-C -i" -fi -unset _compinit_updated_at - -zinit wait lucid for \ - atinit"zpcompinit; zpcdreplay" \ - zdharma/fast-syntax-highlighting \ - atload"!_zsh_autosuggest_start" \ - zsh-users/zsh-autosuggestions \ - blockf \ - zsh-users/zsh-completions - -zmodload -i zsh/complist - -zstyle ':completion:*:processes' command 'ps -ax' -zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;32' -zstyle ':completion:*:*:kill:*' menu yes select -zstyle ':completion:*:kill:*' force-list always - -zstyle ':completion:*:processes-names' command 'ps -e -o comm=' -zstyle ':completion:*:*:killall:*' menu yes select -zstyle ':completion:*:killall:*' force-list always - diff --git a/plugins.zsh b/plugins.zsh deleted file mode 100644 index 94b5b25..0000000 --- a/plugins.zsh +++ /dev/null @@ -1,71 +0,0 @@ -# Менеджер плагинов zinit -if [ ! -d $ZINIT[HOME_DIR] ]; then - git clone https://github.com/zdharma/zinit $ZINIT[HOME_DIR] - zcompile $ZINIT[HOME_DIR]/zinit.zsh -fi - -source $ZINIT[HOME_DIR]/zinit.zsh -autoload -Uz _zinit -(( ${+_comps} )) && _comps[zinit]=_zinit - -# Плагины -zinit load willghatch/zsh-saneopt -zinit load mafredri/zsh-async -zinit load zsh-users/zsh-history-substring-search - -zinit load rupa/z -if [[ "$DISPLAY" != '' ]] && command -v xdotool > /dev/null 2>&1 && command -v wmctrl > /dev/null 2>&1; then - zinit load marzocchi/zsh-notify - zstyle ':notify:*' expire-time 5000 - zstyle ':notify:*' command-complete-timeout 20 - zstyle ':notify:*' enable-on-ssh yes - zstyle ':notify:*' always-check-active-window yes -fi -if command -v peco > /dev/null 2>&1; then - zinit load jimeh/zsh-peco-history -fi - -zinit snippet OMZP::command-not-found -zinit snippet OMZP::common-aliases -zinit snippet OMZP::debian -if command -v fzf > /dev/null 2>&1; then - export DISABLE_FZF_KEY_BINDINGS=true - zinit snippet OMZP::fzf - # fzf - if [ -e /usr/share/doc/fzf/examples/key-bindings.zsh ]; then - . /usr/share/doc/fzf/examples/key-bindings.zsh - fi - if [ -e /usr/share/doc/fzf/examples/completion.zsh ]; then - . /usr/share/doc/fzf/examples/completion.zsh - fi -fi -if command -v git > /dev/null 2>&1; then - zinit snippet OMZP::git - zinit load paulirish/git-open - zinit lucid wait'2' for \ - as"program" pick"$ZPFX/bin/git-*" \ - src"etc/git-extras-completion.zsh" make"PREFIX=$ZPFX" tj/git-extras \ - as"program" make"PREFIX=$ZPFX install" Fakerr/git-recall \ - as"program" load davidosomething/git-my -fi -if command -v psql > /dev/null 2>&1; then - zinit snippet OMZP::postgres -fi -if command -v sudo > /dev/null 2>&1; then - zinit snippet OMZP::sudo -fi -if command -v systemctl > /dev/null 2>&1; then - zinit snippet OMZP::systemd -fi -if command -v vim > /dev/null 2>&1; then - zinit snippet OMZP::vim-interaction -fi -zinit snippet OMZP::web-search - -zinit load djui/alias-tips - -zstyle ':prezto:module:tmux:auto-start' local 'no' -zstyle ':prezto:module:tmux:auto-start' remote 'no' -zstyle ':prezto:module:tmux:session' name "$(hostname)" -zinit snippet PZTM::tmux - From 22197ae61aaf5954d19a90ebe6ffcbc79f4d830e Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Sat, 6 Nov 2021 19:55:26 +0300 Subject: [PATCH 07/11] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b7070de..d97cba2 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ cp ~/.config/zsh/55-agents.zsh ~/.config/zsh/55-agents.user.zsh ## Настройка GPG агента -Раскомментировать в файле ` ~/.config/zsh/agents.user.zsh` строки: +Раскомментировать в файле ` ~/.config/zsh/55-agents.user.zsh` строки: ```text # zgenom ohmyzsh plugins/gpg-agent @@ -74,7 +74,7 @@ pinentry-program /usr/bin/pinentry-qt ## Настройка SSH агента -Раскомментировать в файле ` ~/.config/zsh/agents.user.zsh` строки: +Раскомментировать в файле ` ~/.config/zsh/55-agents.user.zsh` строки: ```text # zstyle :omz:plugins:ssh-agent agent-forwarding on @@ -98,7 +98,7 @@ Host * Для её работы необходимо отключить в системе все автоматические запуски агентов, например в файле `/etc/X11/Xsession.options`. -Раскомментировать в файле ` ~/.config/zsh/agents.user.zsh` строки: +Раскомментировать в файле ` ~/.config/zsh/55-agents.user.zsh` строки: ```text # zstyle :omz:plugins:keychain identities id_rsa 01234567 @@ -113,7 +113,7 @@ Host * ## Инициализация После редактирования файлов настройки запустить `zsh`, в результате чего будет -загружен менеджер пакетов `zgenom` и необходимые плагины. +загружен менеджер пакетов [`zgenom`](https://github.com/jandamm/zgenom/) и необходимые плагины. ## Обновление From 026199797d103d9fd008bed25d90cb2ee3413323 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Sat, 6 Nov 2021 20:29:19 +0300 Subject: [PATCH 08/11] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=81=D0=BA=D1=80=D0=B8=D0=BF=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=20pre=20=D0=B8=20post?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +++-- .zshrc | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 0aacd5b..367a897 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .zcompdump* -keychain-config.zsh *.user.zsh -*.start.zsh +*.post.zsh +*.pre.zsh +*.zwc diff --git a/.zshrc b/.zshrc index be73f87..d3178c1 100644 --- a/.zshrc +++ b/.zshrc @@ -11,8 +11,12 @@ for S in \ 85-compinit \ 95-finish do - [ -e "$ZDOTDIR/$S.zsh" ] && source "$ZDOTDIR/$S.zsh" + N="${S//[0-9\-]/}" + [ -e "$ZDOTDIR/$S.pre.zsh" ] && source "$ZDOTDIR/$S.pre.zsh" + [ -e "$ZDOTDIR/$S.zsh" ] && source "$ZDOTDIR/$S.zsh" [ -e "$ZDOTDIR/$S.user.zsh" ] && source "$ZDOTDIR/$S.user.zsh" + [ -e "$ZDOTDIR/$N.user.zsh" ] && source "$ZDOTDIR/$N.user.zsh" + [ -e "$ZDOTDIR/$S.post.zsh" ] && source "$ZDOTDIR/$S.post.zsh" done true From dc2ac2eef78b7726a812127827f209007b7150cc Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Sat, 6 Nov 2021 20:47:14 +0300 Subject: [PATCH 09/11] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D0=B0=D1=8F=20ZSH=5FIS=5FSUBSHELL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 15-env.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/15-env.zsh b/15-env.zsh index 26cdb1b..212c808 100644 --- a/15-env.zsh +++ b/15-env.zsh @@ -7,6 +7,11 @@ export ZSH_COMPDUMP="$ZSH_CACHE_DIR/completions/dump" export ZGEN_SOURCE="$ZSH_CACHE_DIR" export ZGEN_SOURCE_BIN="$ZSH_CACHE_DIR/plugins" export ZGEN_DIR="$ZSH_CACHE_DIR/zgenom" + +if ps $PPID | grep mc; then + export ZSH_IS_SUBSHELL=1 +fi + ZPFX=$ZGEN_DIR/polaris DISABLE_AUTO_UPDATE=true From 943fc1d242c951148a0ea59ec441cc67126de0bf Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Sun, 7 Nov 2021 10:26:38 +0300 Subject: [PATCH 10/11] =?UTF-8?q?=D0=9E=D1=82=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BD=D0=B5=D0=BA=D0=BE=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=B0=D0=B2=D1=82=D0=BE=D0=B4=D0=BE=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D0=B2=20mc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 85-compinit.zsh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/85-compinit.zsh b/85-compinit.zsh index 0a8a055..d3d2d07 100644 --- a/85-compinit.zsh +++ b/85-compinit.zsh @@ -1,15 +1,17 @@ -typeset -i _compinit_updated_at=$(date +'%j' -r $ZSH_COMPDUMP 2>/dev/null || stat -f '%Sm' -t '%j' $ZSH_COMPDUMP 2>/dev/null) -ZGEN_COMPINIT_FLAGS="-i" -if [ $(date +'%j') = $_compinit_updated_at ]; then - ZGEN_COMPINIT_FLAGS+=" -C" +if [ -z "${ZSH_IS_SUBSHELL}" ]; then + typeset -i _compinit_updated_at=$(date +'%j' -r $ZSH_COMPDUMP 2>/dev/null || stat -f '%Sm' -t '%j' $ZSH_COMPDUMP 2>/dev/null) + ZGEN_COMPINIT_FLAGS="-i" + if [ $(date +'%j') = $_compinit_updated_at ]; then + ZGEN_COMPINIT_FLAGS+=" -C" + fi + unset _compinit_updated_at + + zmodload -i zsh/complist + autoload -Uz compinit && eval "compinit $ZGEN_COMPINIT_FLAGS -d $ZSH_COMPDUMP" + + #zgenom load marlonrichert/zsh-autocomplete + zgenom load zsh-users/zsh-autosuggestions fi -unset _compinit_updated_at - -zmodload -i zsh/complist -autoload -Uz compinit && eval "compinit $ZGEN_COMPINIT_FLAGS -d $ZSH_COMPDUMP" - -#zgenom load marlonrichert/zsh-autocomplete -zgenom load zsh-users/zsh-autosuggestions # Speed up autocomplete, force prefix mapping zstyle ':completion:*' accept-exact '*(N)' From 061989e5562d9c5b1f722a855c6e5a1f3160b861 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Sun, 7 Nov 2021 10:34:23 +0300 Subject: [PATCH 11/11] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=BA=D0=BB=D1=8E?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BB=D0=B0=D0=B3=D0=B8?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 35-options.zsh | 4 ---- 45-plugins.zsh | 6 +++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/35-options.zsh b/35-options.zsh index 9e332c9..133a8c9 100644 --- a/35-options.zsh +++ b/35-options.zsh @@ -1,7 +1,3 @@ -# https://github.com/wting/autojump -# apt-get install autojump -[[ -s /usr/share/autojump/autojump.sh ]] && source /usr/share/autojump/autojump.sh - setopt AUTO_PUSHD # Push the current directory visited on the stack. setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack. setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd. diff --git a/45-plugins.zsh b/45-plugins.zsh index af221ad..8f39c64 100644 --- a/45-plugins.zsh +++ b/45-plugins.zsh @@ -26,10 +26,13 @@ if command -v peco > /dev/null 2>&1; then zgenom load jimeh/zsh-peco-history fi +zgenom ohmyzsh plugins/autojump zgenom ohmyzsh plugins/command-not-found -zgenom ohmyzsh plugins/systemadmin zgenom ohmyzsh plugins/common-aliases zgenom ohmyzsh plugins/debian +zgenom ohmyzsh plugins/isodate +zgenom ohmyzsh plugins/rsync +zgenom ohmyzsh plugins/systemadmin if command -v fzf > /dev/null 2>&1; then export DISABLE_FZF_KEY_BINDINGS=true zgenom ohmyzsh plugins/fzf @@ -38,6 +41,7 @@ if command -v fzf > /dev/null 2>&1; then [ -e /usr/share/doc/fzf/examples/completion.zsh ] && source /usr/share/doc/fzf/examples/completion.zsh fi if command -v git > /dev/null 2>&1; then + GIT_AUTO_FETCH_INTERVAL=3600 zgenom ohmyzsh plugins/git zgenom ohmyzsh plugins/git-auto-fetch zgenom ohmyzsh plugins/git-extras