mirror of
https://github.com/anthonyoteri/dotfiles.git
synced 2026-06-05 15:46:54 -04:00
feat: optimize zsh with lazy-loading, and other improvements
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
|
############################################################
|
||||||
# Homebrew integration
|
# Homebrew integration
|
||||||
|
############################################################
|
||||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
|
|
||||||
# Set the directory we want to store zinit and plugins
|
############################################################
|
||||||
|
# Zinit plugin manager setup
|
||||||
|
############################################################
|
||||||
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
|
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
|
||||||
|
|
||||||
# Download Zinit, if it's not there yet
|
# Download Zinit, if it's not there yet
|
||||||
@@ -13,93 +17,111 @@ fi
|
|||||||
# Source / Load Zinit
|
# Source / Load Zinit
|
||||||
source "${ZINIT_HOME}/zinit.zsh"
|
source "${ZINIT_HOME}/zinit.zsh"
|
||||||
|
|
||||||
# Configure EZA snippet
|
############################################################
|
||||||
|
# EZA configuration
|
||||||
|
############################################################
|
||||||
zstyle ':omz:plugins:eza' 'dirs-first' yes
|
zstyle ':omz:plugins:eza' 'dirs-first' yes
|
||||||
zstyle ':omz:plugins:eza' 'git-status' yes
|
zstyle ':omz:plugins:eza' 'git-status' yes
|
||||||
zstyle ':omz:plugins:eza' 'icons' yes
|
zstyle ':omz:plugins:eza' 'icons' yes
|
||||||
zstyle ':omz:plugins:eza' 'show-group' yes
|
zstyle ':omz:plugins:eza' 'show-group' yes
|
||||||
|
|
||||||
# Add in ZSH Plugins
|
############################################################
|
||||||
|
# ZSH Plugins (essential and lazy-loaded)
|
||||||
|
############################################################
|
||||||
zinit light zsh-users/zsh-syntax-highlighting
|
zinit light zsh-users/zsh-syntax-highlighting
|
||||||
zinit light zsh-users/zsh-completions
|
zinit ice wait"1"; zinit light zsh-users/zsh-completions
|
||||||
zinit light zsh-users/zsh-autosuggestions
|
zinit ice wait"1"; zinit light zsh-users/zsh-autosuggestions
|
||||||
zinit light Aloxaf/fzf-tab
|
zinit ice wait"2"; zinit light Aloxaf/fzf-tab
|
||||||
|
|
||||||
# Add in snippets
|
############################################################
|
||||||
zinit snippet OMZP::aliases
|
# Oh-My-Zsh Snippets (lazy-loaded)
|
||||||
zinit snippet OMZP::ansible
|
############################################################
|
||||||
zinit snippet OMZP::aws
|
zinit ice wait"1"; zinit snippet OMZP::aliases
|
||||||
zinit snippet OMZP::brew
|
zinit ice wait"2"; zinit snippet OMZP::ansible
|
||||||
zinit snippet OMZP::command-not-found
|
zinit ice wait"2"; zinit snippet OMZP::aws
|
||||||
zinit snippet OMZP::common-aliases
|
zinit ice wait"1"; zinit snippet OMZP::brew
|
||||||
zinit snippet OMZP::debian
|
zinit ice wait"2"; zinit snippet OMZP::command-not-found
|
||||||
zinit snippet OMZP::docker
|
zinit ice wait"2"; zinit snippet OMZP::common-aliases
|
||||||
zinit snippet OMZP::docker-compose
|
zinit ice wait"2"; zinit snippet OMZP::debian
|
||||||
zinit snippet OMZP::dotenv
|
zinit ice wait"2"; zinit snippet OMZP::docker
|
||||||
zinit snippet OMZP::eza
|
zinit ice wait"2"; zinit snippet OMZP::docker-compose
|
||||||
zinit snippet OMZP::gh
|
zinit ice wait"2"; zinit snippet OMZP::dotenv
|
||||||
zinit snippet OMZP::git
|
zinit ice wait"1"; zinit snippet OMZP::eza
|
||||||
zinit snippet OMZP::github
|
zinit ice wait"2"; zinit snippet OMZP::gh
|
||||||
zinit snippet OMZP::kitty
|
zinit ice wait"1"; zinit snippet OMZP::git
|
||||||
zinit snippet OMZP::kubectl
|
zinit ice wait"2"; zinit snippet OMZP::github
|
||||||
zinit snippet OMZP::kubectx
|
zinit ice wait"2"; zinit snippet OMZP::kitty
|
||||||
zinit snippet OMZP::nmap
|
zinit ice wait"2"; zinit snippet OMZP::kubectl
|
||||||
zinit snippet OMZP::rust
|
zinit ice wait"2"; zinit snippet OMZP::kubectx
|
||||||
zinit snippet OMZP::ssh
|
zinit ice wait"2"; zinit snippet OMZP::nmap
|
||||||
zinit snippet OMZP::ssh-agent
|
zinit ice wait"2"; zinit snippet OMZP::rust
|
||||||
zinit snippet OMZP::sudo
|
zinit ice wait"2"; zinit snippet OMZP::ssh
|
||||||
|
zinit ice wait"2"; zinit snippet OMZP::ssh-agent
|
||||||
|
zinit ice wait"2"; zinit snippet OMZP::sudo
|
||||||
|
|
||||||
# Load completions
|
############################################################
|
||||||
autoload -U compinit && compinit
|
# Completion system
|
||||||
|
############################################################
|
||||||
|
autoload -U compinit && compinit -C
|
||||||
|
|
||||||
zinit cdreplay -q
|
zinit cdreplay -q
|
||||||
|
|
||||||
# Add in Oh-My-Posh Prompt
|
############################################################
|
||||||
|
# Oh-My-Posh Prompt
|
||||||
|
############################################################
|
||||||
if [ "$TERM_PROGRAM" != "Apple_Terminal" ]; then
|
if [ "$TERM_PROGRAM" != "Apple_Terminal" ]; then
|
||||||
eval "$(oh-my-posh init zsh --config ${HOME}/.config/ohmyposh/omp.toml)"
|
eval "$(oh-my-posh init zsh --config ${HOME}/.config/ohmyposh/omp.toml)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# History
|
############################################################
|
||||||
|
# History configuration
|
||||||
|
############################################################
|
||||||
HISTSIZE=5000
|
HISTSIZE=5000
|
||||||
HISTFILE=~/.zsh_history
|
HISTFILE=~/.zsh_history
|
||||||
SAVEHIST=$HISTSIZE
|
SAVEHIST=$HISTSIZE
|
||||||
HISTDUP=erase
|
HISTDUP=erase
|
||||||
setopt appendhistory
|
# History options grouped for clarity
|
||||||
setopt sharehistory
|
setopt appendhistory sharehistory hist_ignore_space hist_ignore_all_dups hist_save_no_dups hist_ignore_dups
|
||||||
setopt hist_ignore_space
|
|
||||||
setopt hist_ignore_all_dups
|
|
||||||
setopt hist_save_no_dups
|
|
||||||
setopt hist_ignore_dups
|
|
||||||
|
|
||||||
|
############################################################
|
||||||
# Completion styling
|
# Completion styling
|
||||||
|
############################################################
|
||||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
||||||
zstyle ':completion:*' list-colors "${(s.:.)LS_COLOR}"
|
zstyle ':completion:*' list-colors "${(s.:.)LS_COLOR}"
|
||||||
zstyle ':completion:*' menu no
|
zstyle ':completion:*' menu no
|
||||||
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
|
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
|
||||||
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath'
|
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath'
|
||||||
|
|
||||||
|
############################################################
|
||||||
# Shell integrations
|
# Shell integrations
|
||||||
|
############################################################
|
||||||
eval "$(fzf --zsh)"
|
eval "$(fzf --zsh)"
|
||||||
eval "$(zoxide init --cmd cd zsh)"
|
eval "$(zoxide init --cmd cd zsh)"
|
||||||
|
|
||||||
# Export custom environment variables
|
############################################################
|
||||||
|
# Custom environment variables
|
||||||
|
############################################################
|
||||||
export LANG=en_US.UTF-8
|
export LANG=en_US.UTF-8
|
||||||
export EDITOR='nvim'
|
export EDITOR='nvim'
|
||||||
export ARCHFLAGS='-arch x86_64'
|
export ARCHFLAGS='-arch x86_64'
|
||||||
export BAT_CONFIG_PATH=~/.config/bat/config.conf
|
export BAT_CONFIG_PATH=~/.config/bat/config.conf
|
||||||
export GPG_TTY=$(tty)
|
export GPG_TTY=$(tty)
|
||||||
export PATH=${HOME}/.local/bin:${HOME}/.cargo/bin:${HOME}/go/bin:${PATH}
|
export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$HOME/go/bin:$PATH"
|
||||||
export MONOREPO_ROOT=${HOME}/Projects/monorepo
|
export MONOREPO_ROOT="$HOME/Projects/monorepo"
|
||||||
export DOCKER_BUILDKIT=1
|
export DOCKER_BUILDKIT=1
|
||||||
|
|
||||||
# Export SSH_AUTH_SOCK to GPG eo enable using gpgagent as the ssh-agent
|
############################################################
|
||||||
|
# SSH/GPG agent integration
|
||||||
|
############################################################
|
||||||
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
||||||
gpgconf --launch gpg-agent
|
gpgconf --launch gpg-agent
|
||||||
|
|
||||||
|
############################################################
|
||||||
# Custom aliases
|
# Custom aliases
|
||||||
alias cat='bat '
|
############################################################
|
||||||
alias vim=$(which nvim)
|
alias cat='bat'
|
||||||
alias vimdiff="$(which nvim) -d"
|
alias vim='nvim'
|
||||||
alias docker-compose="$(which docker) compose"
|
alias vimdiff='nvim -d'
|
||||||
alias neofetch=fastfetch
|
alias docker-compose='docker compose'
|
||||||
|
alias neofetch='fastfetch'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user