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 <Tab> 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
This commit is contained in:
Alexander Hess 2026-10-06 13:01:48 +02:00
commit 764b9df417
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
2 changed files with 12 additions and 5 deletions

View file

@ -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 **<Tab>`, `ssh **<Tab>`)
#
# 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

View file

@ -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 **<Tab>`, `ssh **<Tab>`)
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 **<Tab>`, `ssh **<Tab>`)
# is set up in ~/.bash_completion, so that it is loaded before `complete_alias`