m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 16:45:38 -05:00

Add another example: play mpd songs with mpc + fzf

Benjamin Chrétien
2015-11-02 21:38:19 +09:00
parent d62ae65f52
commit 17c245fb44

@@ -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