From 9299eccad96f4808c3b7f9487600af58d1119791 Mon Sep 17 00:00:00 2001 From: Noah Knegt Date: Wed, 29 May 2024 17:52:42 +0200 Subject: [PATCH] feat(zsh): Move to zinit Signed-off-by: Noah Knegt --- .config/zsh/plugins.zsh | 22 ++++++++++++ .zshrc | 78 +++++++++++------------------------------ 2 files changed, 42 insertions(+), 58 deletions(-) create mode 100644 .config/zsh/plugins.zsh diff --git a/.config/zsh/plugins.zsh b/.config/zsh/plugins.zsh new file mode 100644 index 0000000..85770e7 --- /dev/null +++ b/.config/zsh/plugins.zsh @@ -0,0 +1,22 @@ +# Add in zsh plugins +zinit light zsh-users/zsh-syntax-highlighting +zinit light zsh-users/zsh-completions +zinit light zsh-users/zsh-autosuggestions + +# Add Oh My Zsh plugins +zinit snippet OMZP::archlinux +zinit snippet OMZP::docker +zinit snippet OMZP::docker-compose +zinit snippet OMZP::dotenv +zinit snippet OMZP::extract +zinit snippet OMZP::git +zinit snippet OMZP::git-auto-fetch +zinit snippet OMZP::gitignore +zinit snippet OMZP::jsontools +zinit snippet OMZP::kubectl +zinit snippet OMZP::rust +zinit snippet OMZP::starship +zinit snippet OMZP::sudo +zinit snippet OMZP::terraform +zinit snippet OMZP::tmux + diff --git a/.zshrc b/.zshrc index 51a244d..4eddcbd 100644 --- a/.zshrc +++ b/.zshrc @@ -1,66 +1,28 @@ -# Path to your oh-my-zsh installation. -ZSH_CORE=/usr/share/zsh/ -ZSH=$HOME/.oh-my-zsh/ +# Set the directory we want to store zinit and plugins +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" +CONFIG_DIR="$HOME/.config/zsh" -# Set name of the theme to load --- if set to "random", it will -# load a random theme each time oh-my-zsh is loaded, in which case, -# to know which specific one was loaded, run: echo $RANDOM_THEME -# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes -ZSH_THEME="amuse" - -# Uncomment the following line to disable bi-weekly auto-update checks. -DISABLE_AUTO_UPDATE="true" - -# Uncomment the following line to enable command auto-correction. -ENABLE_CORRECTION="true" - -# Uncomment the following line if you want to disable marking untracked files -# under VCS as dirty. This makes repository status check for large repositories -# much, much faster. -# DISABLE_UNTRACKED_FILES_DIRTY="true" - -# Which plugins would you like to load? -# Standard plugins can be found in $ZSH/plugins/ -# Custom plugins may be added to $ZSH_CUSTOM/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. -plugins=( - docker - docker-compose - dotenv - extract - git - git-auto-fetch - gitignore - jsontools - kubectl - rust - starship - sudo - terraform - tmux -) - -ZSH_CACHE_DIR=$HOME/.cache/oh-my-zsh -if [[ ! -d $ZSH_CACHE_DIR ]]; then - mkdir $ZSH_CACHE_DIR +# Download Zinit, if it's not there yet +if [ ! -d "$ZINIT_HOME" ]; then + mkdir -p "$(dirname $ZINIT_HOME)" + git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" fi -CONFIG_DIR=$HOME/.config +# Source/Load zinit +source "${ZINIT_HOME}/zinit.zsh" -source $ZSH/oh-my-zsh.sh +# Load plugins +[[ ! -f $CONFIG_DIR/plugins.zsh ]] || source $CONFIG_DIR/plugins.zsh -source $CONFIG_DIR/zsh/alias.zsh -source $CONFIG_DIR/zsh/env.zsh +# Load aliases +[[ ! -f $CONFIG_DIR/alias.zsh ]] || source $CONFIG_DIR/alias.zsh +[[ ! -f $CONFIG_DIR/env.zsh ]] || source $CONFIG_DIR/env.zsh +[[ ! -f $CONFIG_DIR/nvm.zsh ]] || source $CONFIG_DIR/nvm.zsh +[[ ! -f $CONFIG_DIR/pnpm.zsh ]] || source $CONFIG_DIR/pnpm.zsh +[[ ! -f $CONFIG_DIR/sdkman.zsh ]] || source $CONFIG_DIR/sdkman.zsh -[[ -f $ZSH_CORE/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]] && source $ZSH_CORE/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -[[ -f $ZSH_CORE/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh ]] && source $ZSH_CORE/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh +# Load completions +autoload -Uz compinit && compinit -[[ -f $CONFIG_DIR/zsh/nvm.zsh ]] && source $CONFIG_DIR/zsh/nvm.zsh -[[ -f $CONFIG_DIR/zsh/pnpm.zsh ]] && source $CONFIG_DIR/zsh/pnpm.zsh -[[ -f $CONFIG_DIR/zsh/sdkman.zsh ]] && source $CONFIG_DIR/zsh/sdkman.zsh - -# tabtab source for packages -# uninstall by removing these lines -[[ -f ~/.config/tabtab/zsh/__tabtab.zsh ]] && . ~/.config/tabtab/zsh/__tabtab.zsh || true +zinit cdreplay -q -- 2.49.1