From f88bbe3d04b8535e4ef1042c26724e5065e24447 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 18 May 2025 10:49:49 -0500 Subject: source fzf for bash and add functions functions: - pomo plays selected video in sync/pomodoro directory with mpv - song plays selected music file in music directory with mpv --- dotfiles/system/.profile.d/fzf.sh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'dotfiles/system/.profile.d/fzf.sh') diff --git a/dotfiles/system/.profile.d/fzf.sh b/dotfiles/system/.profile.d/fzf.sh index ea5d3dc..02f6d8f 100644 --- a/dotfiles/system/.profile.d/fzf.sh +++ b/dotfiles/system/.profile.d/fzf.sh @@ -2,6 +2,11 @@ # Craig Jennings # fuzzy find settings and utilities, sourced by .profile + +# Set up fzf key bindings and fuzzy completion +source <(fzf --zsh) + + ### SETTINGS export FZF_DEFAULT_OPTS='--height=70%' export FZF_DEFAULT_COMMAND='rg --files' @@ -63,7 +68,7 @@ fif() { ### CONVENIENCE -# Find a book in the calibre library and open it in emacs client. +# Find a book in the calibre library and open it in the default application. # previously: find ~/books \( -iname \*.epub -o -iname \*.pdf -o -iname \*.djvu \) | fzf | xargs emacs bk() { bkfile=$(find ~/sync/books/ \( -iname "*.pdf" -o -iname "*.epub" -o -iname "*.djvu" \) -print | fzf) @@ -71,3 +76,21 @@ bk() { xdg-open "$bkfile" & fi } + + +# play the selected video in the sync/pomodoro directory with mpv +pomo() { + pomo=$(find ~/sync/pomodoro/ \( -iname "*.webm" -o -iname "*.mkv" \) -print | fzf) + if [ -n "$pomo" ]; then + mpv "$pomo" & + fi +} + + +# play the selected song in the music directory with mpg123 +song() { + songfile=$(find ~/music/ \( -iname "*.flac" -o -iname "*.mp3" -o -iname "*.ogg" -o -iname "*.opus" \) -print | fzf) + if [ -n "$songfile" ]; then + mpv --no-video "$songfile" + fi +} -- cgit v1.2.3