From 3c65dd87a23a2170ee7970476819bcd5dfa859af Mon Sep 17 00:00:00 2001 From: Hendrik Boll Date: Thu, 20 Mar 2025 19:02:32 +0100 Subject: [PATCH] zsh: add zsh configs --- dot_zsh/bindkey.zsh | 8 ++++++++ dot_zsh/completion.zsh | 17 +++++++++++++++++ dot_zsh/history.zsh | 3 +++ dot_zsh/hooks.zsh | 13 +++++++++++++ dot_zsh/plugins.zsh | 10 ++++++++++ dot_zsh/setopt.zsh | 29 +++++++++++++++++++++++++++++ 6 files changed, 80 insertions(+) create mode 100644 dot_zsh/bindkey.zsh create mode 100644 dot_zsh/completion.zsh create mode 100644 dot_zsh/history.zsh create mode 100644 dot_zsh/hooks.zsh create mode 100644 dot_zsh/plugins.zsh create mode 100644 dot_zsh/setopt.zsh diff --git a/dot_zsh/bindkey.zsh b/dot_zsh/bindkey.zsh new file mode 100644 index 0000000..c9fd62e --- /dev/null +++ b/dot_zsh/bindkey.zsh @@ -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 diff --git a/dot_zsh/completion.zsh b/dot_zsh/completion.zsh new file mode 100644 index 0000000..c8b7669 --- /dev/null +++ b/dot_zsh/completion.zsh @@ -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' diff --git a/dot_zsh/history.zsh b/dot_zsh/history.zsh new file mode 100644 index 0000000..08bbe50 --- /dev/null +++ b/dot_zsh/history.zsh @@ -0,0 +1,3 @@ +HISTFILE=~/.zsh_history +HISTSIZE=50000 +SAVEHIST=50000 diff --git a/dot_zsh/hooks.zsh b/dot_zsh/hooks.zsh new file mode 100644 index 0000000..ee2b226 --- /dev/null +++ b/dot_zsh/hooks.zsh @@ -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)" diff --git a/dot_zsh/plugins.zsh b/dot_zsh/plugins.zsh new file mode 100644 index 0000000..44ca682 --- /dev/null +++ b/dot_zsh/plugins.zsh @@ -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 diff --git a/dot_zsh/setopt.zsh b/dot_zsh/setopt.zsh new file mode 100644 index 0000000..72f5e14 --- /dev/null +++ b/dot_zsh/setopt.zsh @@ -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