From 6686f6e4ae398131b8875cbbff40bb84ff1b89bf Mon Sep 17 00:00:00 2001 From: Vardan Pogosian Date: Wed, 6 Nov 2024 12:34:11 +0300 Subject: [PATCH] zshrc with oh-my-zsh --- dotfiles/zshrc | 76 ++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/dotfiles/zshrc b/dotfiles/zshrc index 5523a00..8b4464f 100644 --- a/dotfiles/zshrc +++ b/dotfiles/zshrc @@ -1,12 +1,4 @@ time_ms -## -## zinit -## -ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" -[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)" -[ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" -source "${ZINIT_HOME}/zinit.zsh" - ## ## POSIX complaint shell utitly functions and envs ## @@ -15,6 +7,16 @@ source "$HOME/.shell/env" source "$HOME/.shell/aliases" source "$HOME/.shell/xvm" +## +## OhMyZsh +## +export ZSH="$HOME/.oh-my-zsh" +export KEEP_ZSHRC="yes" +[[ -d "$ZSH" && -f "$ZSH/oh-my-zsh.sh" ]] || sh -c "$( + export KEEP_ZSHRC=$KEEP_ZSHRC + curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh +)" + # 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 @@ -71,31 +73,26 @@ DISABLE_UNTRACKED_FILES_DIRTY="true" ZSH_DISABLE_COMPFIX=true # Plugins -zinit ice as"completion" -zinit snippet https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker - -zinit snippet OMZP::git -zinit snippet OMZP::pyenv -zinit snippet OMZP::dotenv -zinit snippet OMZP::sudo -zinit snippet OMZP::golang -zinit snippet OMZP::common-aliases -zinit snippet OMZP::pyenv - -zstyle ':omz:plugins:nvm' autoload yes -zstyle ':omz:plugins:nvm' silent-autoload yes # optionally remove the output generated by NVM when autoloading -zinit snippet OMZP::nvm - -zinit snippet OMZP::colored-man-pages -zinit snippet OMZP::systemd -zinit snippet OMZP::themes -zinit snippet OMZP::perms -zinit snippet OMZP::docker-compose -zinit snippet OMZP::kubectl - -zinit light zsh-users/zsh-syntax-highlighting -zinit light zsh-users/zsh-autosuggestions -zinit light zsh-users/zsh-completions +plugins=( + git + pyenv + dotenv + sudo + golang + common-aliases + pyenv + nvm + colored-man-pages + systemd + themes + perms + docker + docker-compose + kubectl + # globalias +) + +source "$ZSH/oh-my-zsh.sh" ## ## correct only spelling of commands @@ -117,20 +114,19 @@ eval "$(starship init zsh)" ## if [ -n "$HOMEBREW_PREFIX" ]; then - fpath=("$HOMEBREW_PREFIX/share/zsh-completions" $fpath) - fpath=("$HOMEBREW_PREFIX/share/zsh/site-functions" $fpath) - fpath=("$HOMEBREW_PREFIX/completions" $fpath) + fpath=("$HOMEBREW_PREFIX/share/zsh-completions" $fpath) + fpath=("$HOMEBREW_PREFIX/share/zsh/site-functions" $fpath) + fpath=("$HOMEBREW_PREFIX/completions" $fpath) fi ZSH_COMPLETION_DIR="$HOME/.zsh_completion.d" [ ! -d $ZSH_COMPLETION_DIR ] && mkdir -p "$ZSH_COMPLETION_DIR" fpath=("$ZSH_COMPLETION_DIR" $fpath) -## TODO: there is an issue https://github.com/zdharma-continuum/zinit/issues/654 -# [ -f "$HOME/.zsh_completion" ] && source "$HOME/.zsh_completion" -# autoload -Uz compinit && compinit -u +source "$HOME/.zsh_completion" -# zinit cdreplay -q +autoload -Uz compinit && compinit -u +autoload -Uz bashcompinit && bashcompinit ## ## PATH without duplicates