From 446f4efa65c49fc06bd10853baf5e99c7e4b7be4 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Mon, 4 Apr 2022 18:57:24 +0200 Subject: [PATCH] completions/mpv: speed up loading Goes from 200 ms to 100 ms. Probably there is some overhead when calling complete in a loop; we might be able to fix that. --- share/completions/mpv.fish | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/share/completions/mpv.fish b/share/completions/mpv.fish index 660314067..75f62138d 100644 --- a/share/completions/mpv.fish +++ b/share/completions/mpv.fish @@ -1,12 +1,6 @@ -set -l options (string replace -fr '^\s*--([\w-]+).*' '$1' -- (command mpv --list-options 2>/dev/null)) -for opt in $options - complete -c mpv -l "$opt" -end - -set -l flag_options (string replace -fr '^\s*--([\w-]+).*Flag.*' '$1' -- (command mpv --list-options 2>/dev/null)) -for flag_opt in $flag_options - complete -c mpv -l "no-$flag_opt" -end +set -l options (command mpv --list-options 2>/dev/null) +complete -c mpv -l(string replace -fr '^\s*--([\w-]+).*' '$1' -- $options) +complete -c mpv -lno-(string replace -fr '^\s*--([\w-]+).*Flag.*' '$1' -- $options) complete -c mpv -l start -x -d "Seek to given position (%, s, hh:mm:ss)" complete -c mpv -l no-audio -d "Disable audio"