130 lines
7.6 KiB
Text
130 lines
7.6 KiB
Text
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ ZSH Config │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Preoload stuff │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
# Set the directory we want to store zinit and plugins
|
|
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit"
|
|
|
|
# Source/Load zinit, installation is handle by chezmoi external script
|
|
source "${ZINIT_HOME}/zinit.zsh"
|
|
|
|
# source catppuccin theme for zsh-syntax-highlighting
|
|
zinit snippet "https://raw.githubusercontent.com/catppuccin/zsh-syntax-highlighting/main/themes/catppuccin_macchiato-zsh-syntax-highlighting.zsh"
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ ZSH plugins │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
zinit light zsh-users/zsh-syntax-highlighting
|
|
zinit light zsh-users/zsh-completions
|
|
zinit light zsh-users/zsh-autosuggestions
|
|
zinit light Aloxaf/fzf-tab
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Oh My Zsh snippets │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
zinit ice as"completion"; zinit snippet "https://raw.githubusercontent.com/sharkdp/fd/master/contrib/completion/_fd"
|
|
|
|
# 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::dnf
|
|
zinit snippet OMZP::docker
|
|
zinit snippet OMZP::docker-compose
|
|
zinit snippet OMZP::gh
|
|
zinit snippet OMZP::git
|
|
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 │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
HISTSIZE=5000
|
|
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
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ 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:complete:cd:*' fzf-preview 'ls --color $realpath'
|
|
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath'
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Source other files │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
source $HOME/.config/zsh/**/*.zsh
|
|
source $HOME/.config/fzf/fzfrc
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Init external programs │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
source /usr/share/fzf/shell/key-bindings.zsh # change to the following line when <= v0.48
|
|
# eval "$(fzf --zsh)"
|
|
eval "$(zoxide init --cmd cd zsh)"
|
|
eval "$(starship init zsh)"
|