From 11a19acd9e1cc889f1f0206c81be5c05f89cbe11 Mon Sep 17 00:00:00 2001 From: pauljako Date: Sat, 2 Nov 2024 12:16:49 +0100 Subject: [PATCH] feat(main, config): the big fzf update --- config.default | 7 ++++++- main | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/config.default b/config.default index efbe88c..cbab29d 100644 --- a/config.default +++ b/config.default @@ -11,7 +11,12 @@ OMP_THEME="basic" HISTSIZE=5000 # ## Whether to show pfetch when a shell starts or the shell is cleared. Only works if pfetch is installed -## Possible Valuse: 0 (disabled), 1 (enabled, default) +## Possible values: 0 (disabled), 1 (enabled, default) # SHOW_PFETCH=1 # +## Whether to use fzf for shell completions and other cool stuff. Only works when fzf is installed +## Possible values: 0 (disabled), 1 (enabled, default) +# +USE_FZF=1 +# diff --git a/main b/main index 2009d57..2f470f1 100644 --- a/main +++ b/main @@ -89,6 +89,13 @@ zinit light zsh-users/zsh-completions # Inline Command Suggestions based on history zinit light zsh-users/zsh-autosuggestions # +# Initialize fzf if it exists +if [ "${USE_FZF}" = "1" ] && command -v fzf &> /dev/null +then + eval "$(fzf --zsh)" + zinit light Aloxaf/fzf-tab +fi +# # Load the zsh completion system autoload -U compinit && compinit # @@ -119,6 +126,16 @@ alias ls="ls --color=auto" # ls like colored completions zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # +# Ignore completion capitalisation +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' +# +# Disable the default autocompletion if fzf exists and show a better cd completion +if [ "${USE_FZF}" = "1" ] && command -v fzf &> /dev/null +then + zstyle ':completion:*' menu no + zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath' +fi +# # Alias please to run0, doas, sudo or su if command -v doas &> /dev/null then