elvish_config/lib/moi/completion/mpv.elv

60 lines
696 B
Plaintext
Raw Normal View History

2020-03-13 14:03:36 +00:00
use moi/util/condition
use moi/util/file
2021-08-27 20:06:49 +00:00
var extensions = [
2020-03-13 14:03:36 +00:00
aac
ape
avi
divx
flac
flv
m3u
m4a
m4v
mp3
mp4
mpeg
mpg
mkv
mng
mov
qt
oga
ogg
ogm
ogv
opus
ra
rv
ts
vob
wav
webm
wmv
wma
wmx
]
fn -files [m]{
2021-08-27 20:06:49 +00:00
var type = (condition:cset (eq $m '') prefix deep-prefix)
2020-03-13 14:03:36 +00:00
file:match-extensions &type=$type $m $@extensions
}
fn complete [@argv]{
2021-08-27 20:06:49 +00:00
var c = (count $argv)
2020-03-13 14:03:36 +00:00
if (== $c 2) {
put --speed
-files $argv[-1]
} elif (== $c 3) {
if (eq $argv[-2] --speed) {
put 0.8 0.9 1.0 1.1 1.2
} else {
-files $argv[-1]
}
} else {
-files $argv[-1]
}
}
2021-10-13 18:49:48 +00:00
set edit:completion:arg-completer[mpv] = $complete~