minimize zsh config

This commit is contained in:
Alexander Navarro 2025-05-22 13:03:15 -04:00
parent a6c0b4b867
commit 184b398017
2 changed files with 118 additions and 119 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,3 @@
# ╭──────────────────────────────────────────────────────────╮ # ╭──────────────────────────────────────────────────────────╮
# │ ZSH Config │ # │ ZSH Config │
# ╰──────────────────────────────────────────────────────────╯ # ╰──────────────────────────────────────────────────────────╯
@ -25,78 +24,22 @@ zinit snippet "https://raw.githubusercontent.com/catppuccin/zsh-syntax-highlight
# ╰──────────────────────────────────────────────────────────╯ # ╰──────────────────────────────────────────────────────────╯
# BUG: this makes it work funky on some terminals # BUG: this makes it work funky on some terminals
# zinit light zsh-users/zsh-syntax-highlighting # zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-completions zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions zinit light zsh-users/zsh-autosuggestions
zinit light Aloxaf/fzf-tab zinit ice pick"async.zsh" src"pure.zsh"
zinit light sindresorhus/pure
# ╭──────────────────────────────────────────────────────────╮ # ╭──────────────────────────────────────────────────────────╮
# │ Oh My Zsh snippets │ # │ Oh My Zsh snippets │
# ╰──────────────────────────────────────────────────────────╯ # ╰──────────────────────────────────────────────────────────╯
zinit ice as"completion"; zinit snippet "https://raw.githubusercontent.com/sharkdp/fd/master/contrib/completion/_fd" zinit ice as"completion"
zinit ice as"completion"; zinit snippet OMZP::gh zinit snippet "https://raw.githubusercontent.com/sharkdp/fd/master/contrib/completion/_fd"
zinit ice as"completion"; zinit snippet OMZP::docker/completions/_docker
# svn is deprecated, zinit is working in replacing in favor of git: https://github.com/zdharma-continuum/zinit/issues/504
# In the meantime, this plugins will not work
# zinit ice svn; zinit snippet OMZ::plugins/aliases
# zinit ice svn; zinit snippet OMZ::plugins/rust
zinit snippet OMZP::alias-finder
zinit snippet OMZP::colored-man-pages zinit snippet OMZP::colored-man-pages
zinit snippet OMZP::dnf
zinit snippet OMZP::docker-compose
zinit snippet OMZP::git
zinit snippet OMZP::systemd zinit snippet OMZP::systemd
# ╭──────────────────────────────────────────────────────────╮
# │ Plugins options │
# ╰──────────────────────────────────────────────────────────╯
zstyle ':completion:*:*:docker:*' option-stacking yes
zstyle ':completion:*:*:docker-*:*' option-stacking yes
# ╭──────────────────────────────────────────────────────────╮
# │ Load completions │
# ╰──────────────────────────────────────────────────────────╯
# Custom completions
fpath+=${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions
autoload -Uz ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions/*
autoload -Uz compinit && compinit
zinit cdreplay -q
# ╭──────────────────────────────────────────────────────────╮
# │ Keybindings │
# ╰──────────────────────────────────────────────────────────╯
# bindkey -e
# bindkey '^f' auto-suggest-accept
# bindkey '^p' history-search-backward
# bindkey '^n' history-search-forward
# bindkey '^[w' kill-region
#
# # Set VIM keybindings
# # bindkey -v
# export KEYTIMEOUT=1
# # autoload -Uz edit-command-line
# zle -N edit-command-line
# bindkey -M vicmd V edit-command-line # Edits files in vim, hit Shift+v in normal mode
#
# # Add vim text objects
# # autoload -Uz select-bracketed select-quoted
# zle -N select-quoted
# zle -N select-bracketed
# for km in viopp visual; do
# bindkey -M $km -- '-' vi-up-line-or-history
# for c in {a,i}${(s..)^:-\'\"\`\|,./:;=+@}; do
# bindkey -M $km $c select-quoted
# done
# for c in {a,i}${(s..)^:-'()[]{}<>bB'}; do
# bindkey -M $km $c select-bracketed
# done
# done
# ╭──────────────────────────────────────────────────────────╮ # ╭──────────────────────────────────────────────────────────╮
# │ History │ # │ History │
# ╰──────────────────────────────────────────────────────────╯ # ╰──────────────────────────────────────────────────────────╯
@ -112,73 +55,28 @@ setopt hist_save_no_dups
setopt hist_ignore_dups setopt hist_ignore_dups
setopt hist_find_no_dups setopt hist_find_no_dups
# ╭──────────────────────────────────────────────────────────╮
# │ Completion styling │
# ╰──────────────────────────────────────────────────────────╯
# case insensitive completion
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
zstyle ':fzf-tab:*' show-group full
zstyle ':fzf-tab:*' continuous-trigger '/'
zstyle ':fzf-tab:*' fzf-flags --height=10% --layout=reverse --info=inline --ansi -i --preview-window=right:60%:wrap
# ── Previewers ───────────────────────────────────────────────────────
# Directories
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview \
'eza -lha --color=always --icons --git --no-permissions --tree --level 3 --group-directories-first --total-size $realpath'
zstyle ':fzf-tab:complete:cd:*' fzf-preview \
'eza -lha --color=always --icons --git --no-permissions --tree --level 3 --group-directories-first --total-size $realpath'
# systemctl
zstyle ':fzf-tab:complete:systemctl-*:*' fzf-preview 'SYSTEMD_COLORS=1 systemctl status $word'
# git
zstyle ':fzf-tab:complete:git-(add|diff|restore):*' fzf-preview \
'git diff $word | bat -plman --color=always'
zstyle ':fzf-tab:complete:git-log:*' fzf-preview \
'git log --decorate --graph --color=always $word'
zstyle ':fzf-tab:complete:git-help:*' fzf-preview \
'git help $word | bat -plman --color=always'
zstyle ':fzf-tab:complete:git-show:*' fzf-preview \
'case "$group" in
"commit tag") git show --color=always $word ;;
*) git show --color=always $word | bat -plman --color=always ;;
esac'
zstyle ':fzf-tab:complete:git-checkout:*' fzf-preview \
'case "$group" in
"modified file") git diff $word | bat -plman --color=always ;;
"recent commit object name") git show --color=always $word | bat -plman --color=always ;;
*) git log --decorate --graph --color=always $word ;;
esac'
# TLDR
zstyle ':fzf-tab:complete:tldr:argument-1' fzf-preview 'tldr --color always $word'
# ╭──────────────────────────────────────────────────────────╮
# │ ZSH Options │
# ╰──────────────────────────────────────────────────────────╯
setopt EXTENDED_GLOB
setopt DOT_GLOB
setopt GLOB_DOTS
# ╭──────────────────────────────────────────────────────────╮ # ╭──────────────────────────────────────────────────────────╮
# │ Source other files │ # │ Source other files │
# ╰──────────────────────────────────────────────────────────╯ # ╰──────────────────────────────────────────────────────────╯
source $HOME/.config/fzf/fzfrc
# this prevents errors and not loading some files # this prevents errors and not loading some files
for file in $HOME/.config/zsh/**/*.zsh; do for file in $HOME/.config/zsh/**/*.zsh; do
source $file source $file
done done
# ╭──────────────────────────────────────────────────────────╮
# │ Load completions │
# ╰──────────────────────────────────────────────────────────╯
# Custom completions
fpath+=${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions
autoload -Uz ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/completions/*
autoload -Uz complist
autoload -Uz compinit && compinit
zinit cdreplay -q
# ╭──────────────────────────────────────────────────────────╮ # ╭──────────────────────────────────────────────────────────╮
# │ Init external programs │ # │ Init external programs │
# ╰──────────────────────────────────────────────────────────╯ # ╰──────────────────────────────────────────────────────────╯
eval "$(fzf --zsh)"
eval "$(zoxide init --cmd cd zsh)" eval "$(zoxide init --cmd cd zsh)"
eval "$(starship init zsh)"