Load completions at completion rather than load time

What happens when we install a new plugin or remove
an existing plugin? If we don't reload completions,
Fish won't be able to tab-complete for installed or
removed plugins, e.g., continue tab-completing when
they are no longer installed.

By loading `update` and `remove` completions at
completion load time we now invoke `fisher list`
every time the user tabs after `fisher update`
or `fisher remove`.
This commit is contained in:
Jorge Bucaran 2020-11-06 17:19:10 +09:00
parent dcbf55956e
commit 6e3b9d8023
No known key found for this signature in database
GPG key ID: E54BA3C0E646DB30
2 changed files with 1 additions and 7 deletions

View file

@ -1,11 +1,7 @@
complete -c fisher -e
complete -c fisher -x -l help -d "print usage help"
complete -c fisher -x -l version -d "print fisher version"
complete -c fisher -x -n "__fish_use_subcommand" -a install -d "install plugins"
complete -c fisher -x -n "__fish_use_subcommand" -a update -d "update installed plugins"
complete -c fisher -x -n "__fish_use_subcommand" -a remove -d "remove installed plugins"
complete -c fisher -x -n "__fish_use_subcommand" -a list -d "list installed plugins matching <regex>"
for plugin in (fisher list)
complete -c fisher -x -n "__fish_seen_subcommand_from update remove" -a $plugin
end
complete -c fisher -x -n "__fish_seen_subcommand_from update remove" -a "(fisher list)"

View file

@ -144,8 +144,6 @@ function fisher -a cmd -d "fish plugin manager"
functions -q fish_prompt || source $__fish_data_dir/functions/fish_prompt.fish
source $fisher_path/completions/fisher.fish 2>/dev/null
_fisher_list >$fish_plugins
test -s $fish_plugins || command rm -f $fish_plugins