summaryrefslogtreecommitdiffstats
path: root/etc/_mpv.zsh
Commit message (Collapse)AuthorAgeFilesLines
* zsh completion: fix handling of aliases that are listed without --Philip Sequeira2019-12-151-2/+2
| | | | | | Pretty sure they used to all have --, but I guess it was changed at some point. More incentive to do this completion stuff in a more structured way.
* zsh completion: use actual POSIX-compatible regex for whitespacePhilip Sequeira2019-12-151-5/+5
| | | | | | | | | | | | | | \s and \S aren't actually part of the spec, but it seems glibc supports them anyway so I didn't notice when originally testing. This fixes the script on Apple's libc and probably others that adhere more closely to the spec. The most direct replacement for \s would have been [[:space:]], but we only expect to see spaces and tabs, so might as well just do that. Also could have used [[:blank:]], which is basically a locale-aware version of [ \t], but mpv isn't going to output anything but ASCII spaces and tabs, so let's avoid unnecessary complexity and stick with the ASCII literals.
* zsh completion: actually make pcre optionalPhilip Sequeira2019-12-151-7/+6
| | | | | | | | | | It was supposed to be optional already, but I misunderstood how the re_match_pcre option worked. If it's set, it will try to use PCRE matching whether it's available or not (and blow up if it's not). So, first try to load the module it'll use, and only set the option if that works. Fixes #7240.
* zsh completion: move generation to runtime and improvePhilip Sequeira2019-09-271-0/+251
The completion function itself now parses --list-options on the first tab press and caches the results. This does mean a slight delay on that first tab press, but it will only do this if the argument being completed looks like an option (i.e. starts with "-"), so there is never a delay when just completing a file name. I've also put some effort into making it reasonably fast; on my machine it's consistently under 100 ms, more than half of which is mpv itself. Installation of zsh completion is now done unconditionally because it's nothing more than copying a file. If you really don't want it installed, set zshdir to empty: `./waf configure --zshdir= ...` Improvements in functionality compared to the old script: * Produces the right results for mpv binaries other than the one it was installed with (like a dev build for testing changes). * Does not require running mpv at build time, so it won't cause problems with cross compilation. * Handles aliases. * Slightly nicer handling of options that take comma-separated values and/or sub-options: A space is now inserted at the end instead of a comma, allowing you to immediately start typing the next argument, but typing a comma will still remove the automatically added space, and = and : will now do that too, so you can immediately add a sub-option. * More general/flexible handling of values for options that print their possible values with --option=help. The code as is could handle quite a few more options (*scale, demuxers, decoders, ...), but nobody wants to maintain that list here so we'll just stick with what the old completion script already did.