switch to zinit and overhaul

This commit is contained in:
Cy Pokhrel 2024-11-04 10:54:52 -05:00
parent 20c4b1520f
commit 17c9e947eb

92
zshrc
View file

@ -1,22 +1,36 @@
ZSH_THEME="robbyrussell" # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# Uncomment the following line to use case-sensitive completion. # confirmations, etc.) must go above this block; everything else may go below.
# CASE_SENSITIVE="true" if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
# Uncomment the following line to use hyphen-insensitive completion. fi
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled # disable automatic updates
# zstyle ':omz:update' mode auto # update automatically without asking
zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
ZSH_DISABLE_COMPFIX=true ZSH_DISABLE_COMPFIX=true
# completion styling
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-prewview 'ls --color $realpath'
# bindings
bindkey -e
bindkey "^p" history-search-backward
bindkey "^n" history-search-forward
# history
HISTSIZE=50000
HISTFILE=~/.zsh_history
SAVEHIST=$HISTSIZE
HISTDUP=erase
setopt appendhistory
setopt sharehistory
setopt hist_ignore_space
setopt hist_ignore_all_dups
setopt hist_save_no_dups
setopt hist_ignore_dups
setopt hist_find_no_dups
alias vi=nvim alias vi=nvim
alias vim=nvim alias vim=nvim
alias t=tmux alias t=tmux
@ -27,9 +41,9 @@ alias cz=chezmoi
export PATH=$PATH:/home/yt/.cargo/bin export PATH=$PATH:/home/yt/.cargo/bin
source <(fzf --zsh)
export FZF_BASE=/usr/bin export FZF_BASE=/usr/bin
export FZF_DEFAULT_COMMAND=rg export FZF_DEFAULT_COMMAND=rg
export FZF_DEFAULT_OPTS="--tmux"
export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS \ export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS \
--highlight-line \ --highlight-line \
--info=inline-right \ --info=inline-right \
@ -54,8 +68,50 @@ export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS \
--color=spinner:#ff007c \ --color=spinner:#ff007c \
" "
eval "$(zoxide init --cmd cd zsh)"
export NVM_DIR="$HOME/.config/nvm" export NVM_DIR="$HOME/.config/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source <(fzf --zsh) ### Added by Zinit's installer
if [[ ! -f $HOME/.local/share/zinit/zinit.git/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 "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
print -P "%F{33} %F{34}Installation successful.%f%b" || \
print -P "%F{160} The clone has failed.%f%b"
fi
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# Load a few important annexes, without Turbo
# (this is currently required for annexes)
zinit light-mode for \
zdharma-continuum/zinit-annex-as-monitor \
zdharma-continuum/zinit-annex-bin-gem-node \
zdharma-continuum/zinit-annex-patch-dl \
zdharma-continuum/zinit-annex-rust
### End of Zinit's installer chunk
# plugins
zinit ice depth=1; zinit light romkatv/powerlevel10k
zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions
zinit light Aloxaf/fzf-tab
zinit snippet OMZP::git
zinit snippet OMZP::sudo
zinit snippet OMZP::archlinux
zinit snippet OMZP::command-not-found
# load completions
autoload -U compinit && compinit
zinit cdreplay -q
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh