zsh: add zsh configs

This commit is contained in:
fanyx 2025-03-20 19:02:32 +01:00
parent a0d45ec0dd
commit 3c65dd87a2
Signed by: fanyx
SSH key fingerprint: SHA256:Gwc2cuQkLEIzOapSR+R8raHvC1bSAkPsYuPqlPoFlD8
6 changed files with 80 additions and 0 deletions

8
dot_zsh/bindkey.zsh Normal file
View file

@ -0,0 +1,8 @@
bindkey -e
bindkey '^p' history-search-backward
bindkey '^n' history-search-forward
bindkey '^[[1;3D' backward-word # ALT LeftArrowKey
bindkey '^[[1;3C' forward-word # ALT RightArrowKey
bindkey '^[[1;5D' backward-word # CTRL LeftArrowKey
bindkey '^[[1;5C' forward-word # CTRL RightArrowKey
bindkey '^[[3~' delete-char # DEL

17
dot_zsh/completion.zsh Normal file
View file

@ -0,0 +1,17 @@
autoload -U compinit && compinit
zmodload -i zsh/complist
# caching
zstyle ':completion::complete:*' use-cache on
zstyle ':completion::complete:*' cache-path ~/.cache/zsh
zstyle ':completion::complete:*' rehash on
zstyle ':completion:*:default' rehash on
# case-insensitive
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
# no menus
zstyle ':completion:*' menu no
# fzf-tab
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza --tree --level=2 --color=always $realpath'

3
dot_zsh/history.zsh Normal file
View file

@ -0,0 +1,3 @@
HISTFILE=~/.zsh_history
HISTSIZE=50000
SAVEHIST=50000

13
dot_zsh/hooks.zsh Normal file
View file

@ -0,0 +1,13 @@
# fzf
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND="$FZF_DEFAULT_COMMAND"
command -v fzf &>/dev/null && eval "$(fzf --zsh)"
# direnv
command -v direnv &>/dev/null && eval "$(direnv hook zsh)"
# starship
command -v starship &>/dev/null && eval "$(starship init zsh)"
# zoxide
command -v zoxide &>/dev/null && eval "$(zoxide init --cmd cd zsh)"

10
dot_zsh/plugins.zsh Normal file
View file

@ -0,0 +1,10 @@
plugins=(
zsh-users/zsh-syntax-highlighting
zsh-users/zsh-completions
zsh-users/zsh-autosuggestions
Aloxaf/fzf-tab
)
for plugin in $plugins; do
zinit light $plugin
done

29
dot_zsh/setopt.zsh Normal file
View file

@ -0,0 +1,29 @@
setopt nobeep
setopt interactivecomments
setopt extendedglob
# history
setopt appendhistory
setopt extendedhistory
setopt incappendhistory
setopt histexpiredupsfirst
setopt histignoredups
setopt histignorespace
setopt histfindnodups
setopt histreduceblanks
setopt histverify
setopt sharehistory
# completion
setopt alwaystoend
setopt automenu
unsetopt menucomplete
setopt autonamedirs
setopt completeinword
# correction
setopt correct
setopt correctall
# scripts
unsetopt multios