Update zsh config to be more minimal

- config is more centrilize in zshrc
- it doesn't depend on oh-my-zsh
This commit is contained in:
Alexander Navarro 2024-02-20 13:18:05 -03:00
parent 3b99ffe395
commit 5dcbc3a0b2
8 changed files with 123 additions and 180 deletions

View file

@ -1,85 +1,87 @@
# Start mesuring bottlenecks
#/usr/share/fzf/shell/key-bindings.zsh/usr/share/fzf/shell/key-bindings.zsh Start mesuring bottlenecks
if [[ "$ZPROF" = true ]]; then
zmodload zsh/zprof
zmodload zsh/zprof
fi
## Stuff I don't know what they're for
# autoload -Uz compinit
# compinit
#--------------------------------------------------------------------#
# ZSH Config #
#--------------------------------------------------------------------#
# this should before placed before `"$ZSH/oh-my-zsh.sh"`
# Color scheme for syntax highlighting
source ~/.config/zsh/themes/catppuccin_macchiato-zsh-syntax-highlighting.zsh
# 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
export HISTFILE="$HOME/.zsh_history" # History filepath
export HISTSIZE=10000 # Maximum events for internal history
export SAVEHIST=10000 # Maximum events in history file
setopt EXTENDED_HISTORY
# Navigation
setopt AUTO_CD
setopt AUTO_PUSHD
setopt CDABLE_VARS
setopt PUSHD_SILENT
# Completion
setopt AUTO_LIST # Automatically list choices on ambiguous completion.
# setopt CORRECT # Turn on spelling correction for command.
setopt COMPLETE_IN_WORD # Complete from both ends of a word.
setopt GLOB_COMPLETE # Show autocompletion menu with globs
setopt MENU_COMPLETE # Automatically highlight first element of completion menu
fpath+=${ZSH_CUSTOM:-${ZSH:-$XDG_DATA_HOME/oh-my-zsh}/custom}/plugins/zsh-completions/src
fpath+=${XDG_CONFIG_HOME:-$DOTS/config}/zsh/completions
# set VIM keybindings
bindkey -v
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.local/share/oh-my-zsh"
ZSH_THEME="gozilla"
# Case-sensitive completion must be off. _ and - will be interchangeable.
HYPHEN_INSENSITIVE="true"
DISABLE_AUTO_TITLE="true"
# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
# Read Git repos much faster.
DISABLE_UNTRACKED_FILES_DIRTY="true"
# search if exist an alias for the executed command
ZSH_ALIAS_FINDER_AUTOMATIC=true
#--------------------------------------------------------------------#
# Plugin Config #
#--------------------------------------------------------------------#
# VI_MODE_RESET_PROMPT_ON_MODE_CHANGE=true
# VI_MODE_SET_CURSOR=true
ZSHZ_TILDE=1
plugins=(
alias-finder
bgnotify
colored-man-pages
docker
docker-compose
fd
fzf
# git # disabled because I only ocasionally use git from the terminal
safe-paste # don't run code when pasting
systemd
# z # TODO: replace plugin with zoxide
zsh-autocomplete
zsh-autopair
zsh-autosuggestions
zsh-completions
zsh-interactive-cd
zsh-syntax-highlighting
)
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
export HISTCONTROL=ignoreboth:erasedups
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%F{cyan}%BSorry, no matches for: %d%b%f'
zstyle ':completion:*' rehash true
zstyle ':completion:*' use-cache on
# autocomplete: https://github.com/marlonrichert/zsh-autocomplete/blob/main/.zshrc
zstyle ':autocomplete:*' fzf-completion yes
zstyle ':autocomplete:*' min-input 1
zstyle ':autocomplete:*' widget-style menu-select # Tab select instead of autocomplete
source $ZSH/oh-my-zsh.sh
setopt autocd beep extendedglob notify
zstyle ':completion:*' group-name ''
zstyle :compinstall filename '/home/aleidk/.zshrc'
zmodload zsh/complist
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
# FZF config
source /usr/share/fzf/shell/key-bindings.zsh
autoload -U compinit
compinit
setopt GLOB_DOTS
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
#--------------------------------------------------------------------#
# Start Stuff #
@ -87,24 +89,23 @@ source $ZSH/oh-my-zsh.sh
# File directory that are needed to source
files=(
# zsh
$DOTS/config/zsh/**/*.zsh
# fzf scripts that need to be sourced
$DOTS/scripts/fzf-flatpak
# fzf config file
$DOOTS/config/fzf/fzfrc
# zsh
$DOTS/config/zsh/**/*.zsh
# fzf scripts that need to be sourced
$DOTS/scripts/fzf-flatpak
# fzf config file
$DOOTS/config/fzf/fzfrc
)
for file in $files; do
if [[ -f $file ]]; then
emulate -L zsh
source $file
fi
if [[ -f $file ]]; then
emulate -L zsh
source $file
fi
done
if [[ "$ZPROF" = true ]]; then
zprof
zprof
fi
eval "$(starship init zsh)"
@ -112,3 +113,6 @@ eval "$(starship init zsh)"
eval "$(zoxide init zsh)"
eval "$(mise activate zsh)"
# Load syntax highlight at the end so other configuration can use it
# Color scheme for syntax highlighting
source ~/.config/zsh/themes/catppuccin_macchiato-zsh-syntax-highlighting.zsh