Files
.dotfiles/.zshrc
2026-04-03 12:38:12 -04:00

51 lines
1.7 KiB
Bash

# Main zsh settings. env in ~.zprofile
# Read after .zprofile
# source global shell alias & variable files
[ -f "$XDG_CONFIG_HOME/shell/alias" ] && source "$XDG_CONFIG_HOME/shell/alias"
[ -f "$XDG_CONFIG_HOME/shell/vars" ] && source "$XDG_CONFIG_HOME/shell/vars"
# load modules
zmodload zsh/complist
autoload -U compinit && compinit
autoload -U colors && colors
# completion options
zstyle ':completion:*' menu select # tab opens completion menu
zstyle ':completion:*' special-dirs true # show ./ and ../
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} ma=0\;33 # colorize completion menu
# main options
setopt append_history inc_append_history share_history # better history - history appeneded on exit and shared across sessions
setopt auto_param_slash # add the / when autocompleting a dir
setopt no_case_glob no_case_match # case insensitive autocomplete
setopt globdots # include dotfiles
setopt extended_glob # match ~ # ^
setopt interactive_comments # allow comments in the shell
unsetopt prompt_sp # don't autoclean blank lines
stty stop undef # disable accidential ctrl s
# history options
HISTSIZE=100000
SAVEHIST=100000
HISTFILE="$XDG_CACHE_HOME/zsh_history" # move histfile to cache
HISTCONTROL=ignoreboth # consecutive duplicates & commands starting with space are not saved
# fzf setup
export PATH="$HOME/.fzf/bin:$PATH"
source <(fzf --zsh)
# keybinds
bindkey "^a" beginning-of-line
bindkey "^e" end-of-line
bindkey "^R" fzf-history-widget
bindkey "${terminfo[kcuu1]}" history-beginning-search-backward
bindkey "${terminfo[kcud1]}" history-beginning-search-forward
# setup prompt - starship
eval "$(starship init zsh)"
# syntax highlighting
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh