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
35 lines
949 B
Shell
35 lines
949 B
Shell
#!/bin/bash
|
|
|
|
# Custom `bash` completions
|
|
#
|
|
# Sourced automatically by the `bash-completion` package at shell start
|
|
|
|
|
|
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
|
|
|
|
# shellcheck disable=SC2034 # Read by complete_alias sourced below
|
|
COMPAL_AUTO_UNMASK=1
|
|
# shellcheck disable=SC1091 # Third-party file, not linted
|
|
. "${XDG_CONFIG_HOME:-$HOME/.config}/bash/complete_alias"
|
|
|
|
if [ "${#BASH_ALIASES[@]}" -gt 0 ]; then
|
|
complete -F _complete_alias "${!BASH_ALIASES[@]}"
|
|
fi
|