From 764b9df4176f281fd0a517086b0eb9a9fe675303 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Tue, 6 Oct 2026 13:01:48 +0200 Subject: [PATCH] Fix infinite loop in `bash` alias completion fzf's completion.bash was sourced in ~/.bashrc after complete_alias had already masked all aliases in ~/.bash_completion => fzf wrapped _complete_alias for commands like `ls`, so unmasking failed and each recursed into itself, printing "cannot unmask alias command: ls" repeatedly Source fzf's completion.bash in ~/.bash_completion right before complete_alias, so that complete_alias saves fzf's wrappers as the vanilla completions --- .bash_completion | 10 ++++++++++ .bashrc | 7 ++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.bash_completion b/.bash_completion index daa5a4d..5fb1dac 100644 --- a/.bash_completion +++ b/.bash_completion @@ -11,6 +11,16 @@ complete -W '--force' dotfiles-install dotfiles-update complete -W '--quieter' generate-shell-completions +# Fuzzy completion with the `**` trigger +# (e.g., `vi **`, `ssh **`) +# +# Must be sourced before `complete_alias` below, +# which then saves fzf's wrappers as the vanilla completions +if [ -r /usr/share/doc/fzf/examples/completion.bash ]; then + . /usr/share/doc/fzf/examples/completion.bash +fi + + # Automagical completion for all ~/.config/shell/aliases # # See: https://github.com/cykerway/complete-alias diff --git a/.bashrc b/.bashrc index f741755..5cb62c2 100644 --- a/.bashrc +++ b/.bashrc @@ -98,8 +98,5 @@ if [ -r /usr/share/doc/fzf/examples/key-bindings.bash ]; then . /usr/share/doc/fzf/examples/key-bindings.bash fi -# Fuzzy completion with the `**` trigger -# (e.g., `vi **`, `ssh **`) -if [ -r /usr/share/doc/fzf/examples/completion.bash ]; then - . /usr/share/doc/fzf/examples/completion.bash -fi +# Fuzzy completion with the `**` trigger (e.g., `vi **`, `ssh **`) +# is set up in ~/.bash_completion, so that it is loaded before `complete_alias`