mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-28 18:40:55 +02:00
Merge from trunk of workers/{22433,22456,22457,23089}.
This commit is contained in:
parent
21f83e46b2
commit
54ea74d39f
1 changed files with 28 additions and 5 deletions
|
@ -4,15 +4,15 @@ local OUT foo MPD_MUSIC_DIR MPC_PLAYLIST_MATCHER MPC_FORMAT_STRING
|
|||
|
||||
# set this style to whatever --format string you want to use when
|
||||
# constructing the list of playlist entries
|
||||
zstyle -s ':completion:${curcontext}:*' mpc-format-string MPC_FORMAT_STRING
|
||||
zstyle -s ":completion:${curcontext}:*" mpc-format-string MPC_FORMAT_STRING
|
||||
foo=(--format "${(q)MPC_FORMAT_STRING:-%file%}")
|
||||
|
||||
# set this style to the music_directory of mpd to get _files based completion
|
||||
# for commands like "add"
|
||||
zstyle -s ':completion:${curcontext}:' mpd-music-directory MPD_MUSIC_DIR
|
||||
zstyle -s ":completion:${curcontext}:" mpd-music-directory MPD_MUSIC_DIR
|
||||
|
||||
# matcher used for playlist completion
|
||||
zstyle -s ':completion:${curcontext}:' mpd-playlist-matcher \
|
||||
zstyle -s ":completion:${curcontext}:" mpd-playlist-matcher \
|
||||
MPC_PLAYLIST_MATCHER
|
||||
: ${MPC_PLAYLIST_MATCHER:='m:{a-z}={A-Z} l:|=**'}
|
||||
|
||||
|
@ -26,14 +26,19 @@ _mpc_command() {
|
|||
|
||||
mpc_cmds=(
|
||||
add:"add a song to the current playlist"
|
||||
crop:"remove all songs except for the currently playing song"
|
||||
del:"remove a song from the current playlist"
|
||||
play:"start playing"
|
||||
next:"play the next song in the current playlist"
|
||||
prev:"play the previous song in the current playlist"
|
||||
pause:"pause the currently playing song"
|
||||
toggle:"toggles Play/Pause, plays if stopped"
|
||||
stop:"stop the currently playing playlists"
|
||||
seek:"seek to the position specified in percent"
|
||||
clear:"clear the current playlist"
|
||||
outputs:"show the current outputs"
|
||||
enable:"enable a output"
|
||||
disable:"disable a output"
|
||||
shuffle:"shuffle the current playlist"
|
||||
move:"move song in playlist"
|
||||
playlist:"print the current playlist"
|
||||
|
@ -49,7 +54,9 @@ _mpc_command() {
|
|||
search:"search for a song"
|
||||
crossfade:"set and display crossfade settings"
|
||||
update:"scan music directory for updates"
|
||||
stats:"display statistics about MPD"
|
||||
version:"report version of MPD"
|
||||
status:"display MPD status"
|
||||
)
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
|
@ -88,7 +95,7 @@ _mpc_helper_songnumbers() {
|
|||
out=("${(@f)$(_call_program song-numbers mpc $foo playlist 2>/dev/null)}")
|
||||
out=("${(@M)out[@]:#${~MATCH}}")
|
||||
|
||||
sn=("${(@)${(@M)out}//(#b)(#s)\#([0-9]#)*/$match[1]}")
|
||||
sn=("${(@)${(@M)out}//(#b)(#s)(\#|[ >]#)([0-9]#)*/$match[2]}")
|
||||
list=("${(@Mr:COLUMNS-1:)out}")
|
||||
|
||||
_wanted -V 'song numbers' expl 'song number' \
|
||||
|
@ -154,6 +161,13 @@ _mpc_helper_directories() {
|
|||
fi
|
||||
}
|
||||
|
||||
(( $+functions[_mpc_helper_outputs] )) ||
|
||||
_mpc_helper_outputs() {
|
||||
local vals outline
|
||||
vals=(${${${${(M)${(f)"$(mpc outputs 2> /dev/null)"}:#Output * \(*\) is (en|dis)abled}##Output }%%\) is (en|dis)abled}/ \(/:})
|
||||
_describe -t outputs output vals
|
||||
}
|
||||
|
||||
_mpc_add() {
|
||||
_mpc_helper_files
|
||||
}
|
||||
|
@ -170,6 +184,14 @@ _mpc_seek() {
|
|||
_message "floating point percent value"
|
||||
}
|
||||
|
||||
_mpc_enable() {
|
||||
_mpc_helper_outputs
|
||||
}
|
||||
|
||||
_mpc_disable() {
|
||||
_mpc_helper_outputs
|
||||
}
|
||||
|
||||
_mpc_move() {
|
||||
if (( $#words <= 3 )); then
|
||||
_mpc_helper_songnumbers
|
||||
|
@ -228,5 +250,6 @@ _mpc_update() {
|
|||
}
|
||||
|
||||
_arguments \
|
||||
'--format:format string' \
|
||||
'--format[specify the format of song display]:format string' \
|
||||
'--no-status[prevent printing song status on completion]' \
|
||||
'*::mpc command:_mpc_command'
|
||||
|
|
Loading…
Reference in a new issue