feat(zsh): Move to zinit

Signed-off-by: Noah Knegt <git@noahknegt.com>
This commit is contained in:
2024-05-29 17:52:42 +02:00
parent 977e64ec88
commit 9299eccad9
2 changed files with 42 additions and 58 deletions

22
.config/zsh/plugins.zsh Normal file
View File

@@ -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

78
.zshrc
View File

@@ -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