dots/.zinit.zsh
2025-12-05 17:00:35 -08:00

101 lines
3.2 KiB
Bash

#####################
### INSTALL ZINIT ###
#####################
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
if [[ ! -f "${ZINIT_HOME}/zinit.zsh" ]]; then
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
command mkdir -p "$(dirname $ZINIT_HOME)" && command chmod g-rwX "$(dirname $ZINIT_HOME)"
command git clone https://github.com/zdharma-continuum/zinit "$ZINIT_HOME" && \
print -P "%F{33} %F{34}Installation successful.%f%b" || \
print -P "%F{160} The clone has failed.%f%b"
fi
###################
### START ZINIT ###
###################
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
#############
### THEME ###
#############
zinit ice depth=1; zinit light romkatv/powerlevel10k
###############
### PLUGINS ###
###############
# AUTOSUGGESTIONS, TRIGGER PRECMD HOOK UPON LOAD
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
zinit ice wait"0a" lucid atload"_zsh_autosuggest_start"
zinit light zsh-users/zsh-autosuggestions
#SYNTAX HIGHLIGHTING
zinit ice wait"0c" lucid atinit"zpcompinit;zpcdreplay"
zinit light zdharma-continuum/fast-syntax-highlighting
# TAB COMPLETIONS
zinit ice wait"0b" lucid blockf
zinit light zsh-users/zsh-completions
# FZF
zinit ice from"gh-r" as"command" bpick"*linux_amd64*"
zinit light junegunn/fzf
# FZF BYNARY AND TMUX HELPER SCRIPT
zinit ice lucid wait"0c" as"command" id-as"junegunn/fzf-tmux" pick"bin/fzf-tmux"
zinit light junegunn/fzf
# BIND MULTIPLE WIDGETS USING FZF
zinit ice lucid wait"0c" multisrc"shell/{completion,key-bindings}.zsh" id-as"junegunn/fzf_completions" pick"/dev/null"
zinit light junegunn/fzf
# FZF-TAB
zinit ice wait="1" lucid
zinit light Aloxaf/fzf-tab
# ENHANCD
zinit ice wait="0b" lucid
zinit light babarot/enhancd
export ENHANCD_FILTER=fzf:fzy:peco
# ZOXIDE
zinit ice wait"0a" lucid from"gh-r" as"program" pick"zoxide-*/zoxide -> zoxide" cp"zoxide-*/completions/_zoxide -> _zoxide" atclone"./zoxide init zsh > init.zsh" atpull"%atclone" src"init.zsh"
zinit light ajeetdsouza/zoxide
# EZA
zinit ice wait lucid from'gh-r' id-as as'completion' bpick'man-*' atpull'%atclone' atclone'
local VERSION=$(ls target | sed "s/man-//")
if [[ "$(uname -s)" = "Darwin"* ]]; then
local -A ICE=(ver eza-$VERSION)
.zinit-get-latest-gh-r-url-part cargo-bins cargo-quickinstall
else
local -A ICE=(bpick "eza*")
.zinit-get-latest-gh-r-url-part eza-community eza
fi
[ -n "$reply" ] && wget https://github.com/$reply -O eza.tar.gz && tar -xzf eza.tar.gz && rm -f eza.tar.gz && ln -svf $PWD/eza $ZPFX/bin
wget https://raw.githubusercontent.com/eza-community/eza/main/completions/zsh/_eza -O _eza
for man in $PWD/target/*/*.1; do ln -svf $man $ZPFX/man/man1; done
for man in $PWD/target/*/*.5; do ln -svf $man $ZPFX/man/man5; done'
zinit light eza-community/eza
# VI MODE
zinit ice depth=1
zinit light jeffreytse/zsh-vi-mode
################
### SNIPPETS ###
################
zinit snippet OMZP::git
zinit snippet OMZP::sudo
zinit snippet OMZP::command-not-found
# replay cached completions
zinit cdreplay -q