Переход на zdharma/zinit

This commit is contained in:
Andrei Astafev 2021-07-13 16:17:09 +03:00
parent a3b19b9f4c
commit ba6c92a2ce
8 changed files with 108 additions and 68 deletions

3
.zshrc
View File

@ -21,6 +21,7 @@ source $ZDOTDIR/prompt.zsh
source $ZDOTDIR/aliases.zsh source $ZDOTDIR/aliases.zsh
[ -e $ZDOTDIR/aliases.user.zsh ] && source $ZDOTDIR/aliases.user.zsh [ -e $ZDOTDIR/aliases.user.zsh ] && source $ZDOTDIR/aliases.user.zsh
zplug load source $ZDOTDIR/compinit.zsh
[ -e $ZDOTDIR/compinit.user.zsh ] && source $ZDOTDIR/compinit.user.zsh
true true

View File

@ -6,12 +6,12 @@
# zstyle :omz:plugins:ssh-agent agent-forwarding on # zstyle :omz:plugins:ssh-agent agent-forwarding on
# zstyle :omz:plugins:ssh-agent identities id_rsa # zstyle :omz:plugins:ssh-agent identities id_rsa
# zstyle :omz:plugins:ssh-agent lifetime 10h # zstyle :omz:plugins:ssh-agent lifetime 10h
# zplug "plugins/ssh-agent", from:oh-my-zsh # zinit snippet OMZP::ssh-agent
## ##
# GPG agent # GPG agent
## ##
# zplug "plugins/gpg-agent", from:oh-my-zsh # zinit snippet OMZP::gpg-agent
## ##
# Keychain # Keychain
@ -19,5 +19,5 @@
# zstyle :omz:plugins:keychain identities id_rsa 01234567 # zstyle :omz:plugins:keychain identities id_rsa 01234567
# zstyle :omz:plugins:keychain options --quiet --inherit local-once --noask --nocolor --quick # zstyle :omz:plugins:keychain options --quiet --inherit local-once --noask --nocolor --quick
# zstyle :omz:plugins:keychain agents gpg,ssh # zstyle :omz:plugins:keychain agents gpg,ssh
# zplug "plugins/keychain", from:oh-my-zsh # zinit snippet OMZP::keychain

View File

@ -22,6 +22,9 @@ apts() {
fi fi
} }
# VIM
alias gvim='gvim --remote-silent'
# Youtube # Youtube
YDL="$HOME/bin/youtube-dl" YDL="$HOME/bin/youtube-dl"
[ ! -x "$YDL" ] && YDL="$(which youtube-dl)" [ ! -x "$YDL" ] && YDL="$(which youtube-dl)"

27
compinit.zsh Normal file
View File

@ -0,0 +1,27 @@
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

10
env.zsh
View File

@ -2,9 +2,15 @@ export XDG_CONFIG_HOME=$HOME/.config
export XDG_CACHE_HOME=$HOME/.cache export XDG_CACHE_HOME=$HOME/.cache
export XDG_DATA_HOME=$HOME/.local/share export XDG_DATA_HOME=$HOME/.local/share
export ZPLUG_HOME=$XDG_CACHE_HOME/zplug declare -A ZINIT
export PATH=$HOME/bin:$HOME/.local/bin:$PATH 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
ZPFX=$XDG_CACHE_HOME/zsh/polaris
export PATH=$HOME/bin:$HOME/.local/bin:$PATH
# Удалить дубликаты в PATH # Удалить дубликаты в PATH
typeset -U PATH typeset -U PATH

View File

@ -2,25 +2,15 @@
# apt-get install autojump # apt-get install autojump
[[ -s /usr/share/autojump/autojump.sh ]] && source /usr/share/autojump/autojump.sh [[ -s /usr/share/autojump/autojump.sh ]] && source /usr/share/autojump/autojump.sh
# Автодополнение autoload -Uz allopt zed zmv zcalc colors
autoload -Uz compinit colors
autoload zmv
typeset -i updated_at=$(date +'%j' -r ~/.zcompdump 2>/dev/null || stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null) autoload -Uz edit-command-line
if [ $(date +'%j') != $updated_at ]; then zle -N edit-command-line
compinit -i #bindkey -M vicmd v edit-command-line
else
compinit -C -i
fi
zmodload -i zsh/complist autoload -Uz select-word-style
select-word-style shell
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
autoload -Uz url-quote-magic
zle -N self-insert url-quote-magic

View File

@ -1,35 +1,35 @@
# Менеджер плагинов zplug # Менеджер плагинов zinit
if [ ! -d $ZPLUG_HOME ]; then if [ ! -d $ZINIT[HOME_DIR] ]; then
git clone https://github.com/zplug/zplug $ZPLUG_HOME git clone https://github.com/zdharma/zinit $ZINIT[HOME_DIR]
zcompile $ZINIT[HOME_DIR]/zinit.zsh
fi fi
source $ZPLUG_HOME/init.zsh source $ZINIT[HOME_DIR]/zinit.zsh
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# Плагины # Плагины
zplug "zdharma/fast-syntax-highlighting", defer:2 zinit load willghatch/zsh-saneopt
zinit load mafredri/zsh-async
zinit load zsh-users/zsh-history-substring-search
# Make sure to use double quotes zinit load rupa/z
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 if [[ "$DISPLAY" != '' ]] && command -v xdotool > /dev/null 2>&1 && command -v wmctrl > /dev/null 2>&1; then
zplug "marzocchi/zsh-notify" zinit load marzocchi/zsh-notify
zstyle ':notify:*' expire-time 6000 zstyle ':notify:*' expire-time 5000
zstyle ':notify:*' command-complete-timeout 20 zstyle ':notify:*' command-complete-timeout 20
zstyle ':notify:*' enable-on-ssh yes
fi fi
if command -v peco > /dev/null 2>&1; then if command -v peco > /dev/null 2>&1; then
zplug "jimeh/zsh-peco-history" zinit load jimeh/zsh-peco-history
fi fi
zplug "plugins/command-not-found", from:oh-my-zsh zinit snippet OMZP::command-not-found
zplug "plugins/common-aliases", from:oh-my-zsh zinit snippet OMZP::common-aliases
zplug "plugins/debian", from:oh-my-zsh zinit snippet OMZP::debian
if command -v fzf > /dev/null 2>&1; then if command -v fzf > /dev/null 2>&1; then
export DISABLE_FZF_KEY_BINDINGS=true export DISABLE_FZF_KEY_BINDINGS=true
zplug "plugins/fzf", from:oh-my-zsh zinit snippet OMZP::fzf
# fzf # fzf
if [ -e /usr/share/doc/fzf/examples/key-bindings.zsh ]; then if [ -e /usr/share/doc/fzf/examples/key-bindings.zsh ]; then
. /usr/share/doc/fzf/examples/key-bindings.zsh . /usr/share/doc/fzf/examples/key-bindings.zsh
@ -39,14 +39,26 @@ if command -v fzf > /dev/null 2>&1; then
fi fi
fi fi
if command -v git > /dev/null 2>&1; then if command -v git > /dev/null 2>&1; then
zplug "plugins/git", from:oh-my-zsh 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 fi
if command -v psql > /dev/null 2>&1; then if command -v psql > /dev/null 2>&1; then
zplug "plugins/postgres", from:oh-my-zsh zinit snippet OMZP::postgres
fi fi
zplug "plugins/sudo", from:oh-my-zsh if command -v sudo > /dev/null 2>&1; then
zplug "plugins/systemd", from:oh-my-zsh zinit snippet OMZP::sudo
zplug "plugins/vim-interaction", from:oh-my-zsh fi
zplug "plugins/web-search", from:oh-my-zsh 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
zplug "djui/alias-tips" zinit load djui/alias-tips

View File

@ -27,8 +27,9 @@ if [[ "$TERM_PROGRAM" == "Hyper" ]]; then
SPACESHIP_GIT_BRANCH_SHOW=false SPACESHIP_GIT_BRANCH_SHOW=false
fi fi
if __zplug::base::base::zsh_version 5.2; then autoload is-at-least
zplug "denysdovhan/spaceship-prompt" if is-at-least "5.2" "$ZSH_VERSION"; then
zinit load "denysdovhan/spaceship-prompt"
else else
zplug "nojhan/liquidprompt" zinit load "nojhan/liquidprompt"
fi fi