1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-12-22 07:31:39 +01:00

zsh: migrate from antibody to antidote

See https://getantidote.github.io and https://github.com/mattmc3/antidote
This commit is contained in:
bretello 2024-04-06 21:24:30 +02:00
parent a9a45864d2
commit edc1934e83
Signed by: brethil
GPG Key ID: 876AAC6290170FE7
4 changed files with 74 additions and 44 deletions

View File

@ -1,24 +0,0 @@
# vim:ft=zsh
djui/alias-tips
robbyrussell/oh-my-zsh
robbyrussell/oh-my-zsh path:plugins/ansible
robbyrussell/oh-my-zsh path:plugins/bgnotify
robbyrussell/oh-my-zsh path:plugins/colored-man-pages
robbyrussell/oh-my-zsh path:plugins/common-aliases
robbyrussell/oh-my-zsh path:plugins/docker
robbyrussell/oh-my-zsh path:plugins/docker-compose
robbyrussell/oh-my-zsh path:plugins/fzf
robbyrussell/oh-my-zsh path:plugins/git
robbyrussell/oh-my-zsh path:plugins/golang
robbyrussell/oh-my-zsh path:plugins/grc
robbyrussell/oh-my-zsh path:plugins/pip
robbyrussell/oh-my-zsh path:plugins/pyenv
robbyrussell/oh-my-zsh path:plugins/pylint
robbyrussell/oh-my-zsh path:plugins/sudo
robbyrussell/oh-my-zsh path:plugins/vagrant
robbyrussell/oh-my-zsh path:plugins/vi-mode
zsh-users/zsh-autosuggestions
zsh-users/zsh-completions
zsh-users/zsh-syntax-highlighting
joshskidmore/zsh-fzf-history-search
ryutok/rust-zsh-completions

View File

@ -9,10 +9,52 @@ export VIRTUAL_ENV_DISABLE_PROMPT=true
export PATH=$PATH:$HOME/bin
# Source all zsh plugins
source <(antibody init)
export ANTIBODY="$(antibody home)"
antibody bundle < "$DOTFILES/antibody_plugins.txt"
if [[ -d "$HOME/.cache/antibody" ]]; then
# antibody migration cleanup
rm -rf $HOME/.cache/antibody
fi
if [[ ! -d $DOTFILES/antidote ]]; then
git clone https://github.com/mattmc3/antidote.git ${DOTFILES}/antidote
fi
export ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh"
[[ -d $ZSH_CACHE_DIR ]] || mkdir -p $ZSH_CACHE_DIR
# Lazy-load antidote from its functions directory.
fpath=($DOTFILES/antidote/functions/ $fpath)
autoload -Uz antidote
autoload -Uz compinit && compinit
autoload -Uz bashcompinit && bashcompinit
# Lazy-load antidote and generate the static load file only when needed # TODO: look into deferred loading with zsh-defer
zsh_plugins="$DOTFILES/zsh_plugins"
if [[ ! ${zsh_plugins}.zsh -nt ${zsh_plugins}.txt ]]; then
(
echo loading $zsh_plugins.txt
source $DOTFILES/antidote/antidote.zsh
echo "ZSH=$(antidote path ohmyzsh/ohmyzsh)" >${zsh_plugins}.zsh
antidote bundle <${zsh_plugins}.txt >>${zsh_plugins}.zsh
if [[ $+commands[systemctl] ]]; then
antidote bundle robbyrussell/oh-my-zsh path:plugins/systemd >>${zsh_plugins}.zsh
fi
if [[ $+commands[pacman] ]]; then
antidote bundle robbyrussell/oh-my-zsh path:plugins/archlinux >>${zsh_plugins}.zsh
elif [[ $+commands[apt-get] ]]; then
antidote bundle robbyrussell/oh-my-zsh path:plugins/debian >>${zsh_plugins}.zsh
fi
)
fi
source ${zsh_plugins}.zsh
source "$DOTFILES/themes/brethil.zsh-theme"
# Setup completion style
source $DOTFILES/completion_style.zsh
@ -25,20 +67,8 @@ else
fi
export FZF_CTRL_T_OPTS=" --preview-window=right,60% --preview \"bash -c 'if [[ -d \"{}\" ]]; then tree -C \"{}\"; else bat --style=plain --color=always \"{}\"; fi'\" --bind 'ctrl-/:change-preview-window(right,70%|down,40%,border-horizontal|hidden|right)'"
if [[ $+commands[systemctl] ]]; then
antibody bundle robbyrussell/oh-my-zsh path:plugins/systemd
fi
if [[ $+commands[pacman] ]]; then
antibody bundle robbyrussell/oh-my-zsh path:plugins/archlinux
elif [[ $+commands[apt-get] ]]; then
antibody bundle robbyrussell/oh-my-zsh path:plugins/debian
fi
ZSH_HIGHLIGHT_STYLES[comment]='fg=white,bg=gray,bold'
# Setup oh-my-zsh path
export ZSH="$(antibody path robbyrussell/oh-my-zsh)"
# Enable zsh autocorrection
setopt CORRECT_ALL
@ -60,7 +90,7 @@ unsetopt LIST_BEEP
## Misc environment variables
# https://www.xkcd.com/378/
export EDITOR="vim" # if antibody_plugins.txt includes robbyrussell/oh-my-zsh path:plugins/vi-mode, this also sets `bindkey -v`
export EDITOR="vim" # if antibody_plugins.txt includes robbyrussell/oh-my-zsh path:plugins/vi-mode, this also sets `bindkey -v` # FIXME
export VI_MODE_RESET_PROMPT_ON_MODE_CHANGE=true # refresh prompt on every mode change
# Fix delete (delete! not backspace) key
bindkey -a '^[[3~' delete-char
@ -147,8 +177,8 @@ test -f "${functions_file}" && source "${functions_file}"
test -f "${aliases_file}" && source "${aliases_file}"
test -f "${ssh_file}" && source "${ssh_file}"
autoload -U compinit && compinit
autoload -U bashcompinit && bashcompinit
# autoload -U compinit && compinit
# autoload -U bashcompinit && bashcompinit
# Set DISABLE_DOTFILES_AUTOUPDATE=true to disable updates
source "${DOTFILES}/extras/check_for_update.zsh"

View File

@ -30,7 +30,7 @@ function _update_dotfiles_update() {
function update_dotfiles() {
(cd $DOTFILES; git pull -q --rebase && echo "Succesfully upgraded dotfiles" || echo "Could not upgrade dotfiles.")
antibody update
(cd $DOTFILES/antidote && git pull -rebase || echo "Could not upgrade antidote")
vim -c 'PlugUpdate|PlugClean|qa!'
# update the zsh file
_update_dotfiles_update

24
zsh_plugins.txt Normal file
View File

@ -0,0 +1,24 @@
# vim:ft=zsh
djui/alias-tips
ohmyzsh/ohmyzsh path:lib
ohmyzsh/ohmyzsh path:plugins/ansible
ohmyzsh/ohmyzsh path:plugins/bgnotify
ohmyzsh/ohmyzsh path:plugins/colored-man-pages
ohmyzsh/ohmyzsh path:plugins/common-aliases
ohmyzsh/ohmyzsh path:plugins/docker
ohmyzsh/ohmyzsh path:plugins/docker-compose
ohmyzsh/ohmyzsh path:plugins/fzf
ohmyzsh/ohmyzsh path:plugins/git
ohmyzsh/ohmyzsh path:plugins/golang
ohmyzsh/ohmyzsh path:plugins/grc
ohmyzsh/ohmyzsh path:plugins/pip
ohmyzsh/ohmyzsh path:plugins/pyenv
ohmyzsh/ohmyzsh path:plugins/pylint
ohmyzsh/ohmyzsh path:plugins/sudo
ohmyzsh/ohmyzsh path:plugins/vagrant
ohmyzsh/ohmyzsh path:plugins/vi-mode
zsh-users/zsh-autosuggestions
zsh-users/zsh-completions
zsh-users/zsh-syntax-highlighting
joshskidmore/zsh-fzf-history-search
ryutok/rust-zsh-completions