From 17c245fb4497230427653e9f09970210d121ffa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Chr=C3=A9tien?= Date: Mon, 2 Nov 2015 21:38:19 +0900 Subject: [PATCH] Add another example: play mpd songs with mpc + fzf --- Examples.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Examples.md b/Examples.md index 401f542..632ac2b 100644 --- a/Examples.md +++ b/Examples.md @@ -513,6 +513,20 @@ zle -N fzf-locate-widget bindkey '\ei' fzf-locate-widget ``` +### mpd + +You must have [`mpc`](http://www.musicpd.org/clients/mpc/) installed on your computer in order to use this function. + +```sh +fmpc() { + local song_position + song_position=$(mpc -f "%position%) %artist% - %title%" playlist | \ + fzf-tmux --query="$1" --reverse --select-1 --exit-0 | \ + sed -n 's/^\([0-9]\+\)).*/\1/p') || return 1 + [ -n "$song_position" ] && mpc -q play $song_position +} +``` + ### Readline ```sh