summaryrefslogtreecommitdiffstats
path: root/etc/_mpv.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'etc/_mpv.zsh')
-rw-r--r--etc/_mpv.zsh25
1 files changed, 20 insertions, 5 deletions
diff --git a/etc/_mpv.zsh b/etc/_mpv.zsh
index a15bb7c9ed..64795ddb23 100644
--- a/etc/_mpv.zsh
+++ b/etc/_mpv.zsh
@@ -42,7 +42,7 @@ function _mpv_generate_arguments {
local -a option_aliases=()
local list_options_line
- for list_options_line in "${(@f)$($words[1] --list-options)}"; do
+ for list_options_line in "${(@f)$($~words[1] --no-config --list-options)}"; do
[[ $list_options_line =~ $'^[ \t]+--([^ \t]+)[ \t]*(.*)' ]] || continue
@@ -77,6 +77,10 @@ function _mpv_generate_arguments {
# Save this for later; we might not have parsed the target option yet
option_aliases+="$name $match[2]"
+ elif [[ $desc =~ $'^removed ' ]]; then
+
+ # skip
+
else
# Option takes argument
@@ -97,7 +101,7 @@ function _mpv_generate_arguments {
entry+='->files'
- elif [[ $name == (ao|vo|af|vf|profile|audio-device|vulkan-device) ]]; then
+ elif [[ $desc = 'Object settings list'* || $name == (profile|audio-device|vulkan-device) ]]; then
entry+="->parse-help-$name"
@@ -105,6 +109,10 @@ function _mpv_generate_arguments {
entry+="->parse-help-profile"
+ elif [[ $name == h(|elp) ]]; then
+
+ entry+="->help-options"
+
fi
_mpv_completion_arguments+="$entry"
@@ -146,7 +154,7 @@ function _mpv_generate_arguments {
function _mpv_generate_protocols {
_mpv_completion_protocols=()
local list_protos_line
- for list_protos_line in "${(@f)$($words[1] --list-protocols)}"; do
+ for list_protos_line in "${(@f)$($~words[1] --no-config --list-protocols)}"; do
if [[ $list_protos_line =~ $'^[ \t]+(.*)' ]]; then
_mpv_completion_protocols+="$match[1]"
fi
@@ -158,7 +166,7 @@ function _mpv_generate_if_changed {
# on the first run and re-generates it if the executable being completed for
# is different than the one we used to generate the cached list.
typeset -gA _mpv_completion_binary
- local current_binary=${words[1]:c}
+ local current_binary=${~words[1]:c}
zmodload -F zsh/stat b:zstat
current_binary+=T$(zstat +mtime $current_binary)
if [[ $_mpv_completion_binary[$1] != $current_binary ]]; then
@@ -188,6 +196,7 @@ case $state in
parse-help-*)
local option_name=${state#parse-help-}
+ local no_config="--no-config"
# Can't do non-capturing groups without pcre, so we index the ones we want
local pattern name_group=1 desc_group=2
case $option_name in
@@ -199,6 +208,8 @@ case $state in
# but would break if a profile name contained spaces. This stricter one
# only breaks if a profile name contains tabs.
pattern=$'^\t([^\t]*)\t(.*)'
+ # We actually want config so we can autocomplete the user's profiles
+ no_config=""
;;
*)
pattern=$'^[ \t]+(--'${option_name}$'=)?([^ \t]+)[ \t]*[-:]?[ \t]*(.*)'
@@ -207,7 +218,7 @@ case $state in
esac
local -a values
local current
- for current in "${(@f)$($words[1] --${option_name}=help)}"; do
+ for current in "${(@f)$($~words[1] ${no_config} --${option_name}=help)}"; do
[[ $current =~ $pattern ]] || continue;
local name=${match[name_group]//:/\\:} desc=${match[desc_group]}
if [[ -n $desc ]]; then
@@ -245,6 +256,10 @@ case $state in
done
;;
+ help-options)
+ compadd ${${${_mpv_completion_arguments%%=*}:#no-*}:#*-(add|append|clr|pre|set|remove|toggle)}
+ ;;
+
esac
return rc