Переход на 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
[ -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

View File

@ -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
# zplug "plugins/ssh-agent", from:oh-my-zsh
# zinit snippet OMZP::ssh-agent
##
# GPG agent
##
# zplug "plugins/gpg-agent", from:oh-my-zsh
# zinit snippet OMZP::gpg-agent
##
# 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
# zplug "plugins/keychain", from:oh-my-zsh
# zinit snippet OMZP::keychain

View File

@ -22,6 +22,9 @@ apts() {
fi
}
# VIM
alias gvim='gvim --remote-silent'
# Youtube
YDL="$HOME/bin/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_DATA_HOME=$HOME/.local/share
export ZPLUG_HOME=$XDG_CACHE_HOME/zplug
export PATH=$HOME/bin:$HOME/.local/bin:$PATH
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
ZPFX=$XDG_CACHE_HOME/zsh/polaris
export PATH=$HOME/bin:$HOME/.local/bin:$PATH
# Удалить дубликаты в PATH
typeset -U PATH

View File

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

View File

@ -1,35 +1,35 @@
# Менеджер плагинов zplug
if [ ! -d $ZPLUG_HOME ]; then
git clone https://github.com/zplug/zplug $ZPLUG_HOME
# Менеджер плагинов 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 $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
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"
zinit load rupa/z
if [[ "$DISPLAY" != '' ]] && command -v xdotool > /dev/null 2>&1 && command -v wmctrl > /dev/null 2>&1; then
zplug "marzocchi/zsh-notify"
zstyle ':notify:*' expire-time 6000
zinit 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
zplug "jimeh/zsh-peco-history"
zinit load jimeh/zsh-peco-history
fi
zplug "plugins/command-not-found", from:oh-my-zsh
zplug "plugins/common-aliases", from:oh-my-zsh
zplug "plugins/debian", from:oh-my-zsh
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
zplug "plugins/fzf", from:oh-my-zsh
zinit snippet OMZP::fzf
# fzf
if [ -e /usr/share/doc/fzf/examples/key-bindings.zsh ]; then
. /usr/share/doc/fzf/examples/key-bindings.zsh
@ -39,14 +39,26 @@ if command -v fzf > /dev/null 2>&1; then
fi
fi
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
if command -v psql > /dev/null 2>&1; then
zplug "plugins/postgres", from:oh-my-zsh
zinit snippet OMZP::postgres
fi
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
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
zplug "djui/alias-tips"
zinit load djui/alias-tips

View File

@ -1,17 +1,17 @@
# Theme
# Install powerline font
SPACESHIP_PROMPT_ORDER=(
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
hg # Mercurial section (hg_branch + hg_status)
exec_time # Execution time
line_sep # Line break
vi_mode # Vi-mode indicator
jobs # Background jobs indicator
exit_code # Exit code section
char # Prompt character
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
hg # Mercurial section (hg_branch + hg_status)
exec_time # Execution time
line_sep # Line break
vi_mode # Vi-mode indicator
jobs # Background jobs indicator
exit_code # Exit code section
char # Prompt character
)
@ -22,13 +22,14 @@ SPACESHIP_CHAR_SUFFIX=" "
# Simplify prompt if we're using Hyper
if [[ "$TERM_PROGRAM" == "Hyper" ]]; then
SPACESHIP_PROMPT_SEPARATE_LINE=false
SPACESHIP_DIR_SHOW=false
SPACESHIP_GIT_BRANCH_SHOW=false
SPACESHIP_PROMPT_SEPARATE_LINE=false
SPACESHIP_DIR_SHOW=false
SPACESHIP_GIT_BRANCH_SHOW=false
fi
if __zplug::base::base::zsh_version 5.2; then
zplug "denysdovhan/spaceship-prompt"
autoload is-at-least
if is-at-least "5.2" "$ZSH_VERSION"; then
zinit load "denysdovhan/spaceship-prompt"
else
zplug "nojhan/liquidprompt"
zinit load "nojhan/liquidprompt"
fi