diff options
Diffstat (limited to 'dotfiles/system/.profile.d')
| -rw-r--r-- | dotfiles/system/.profile.d/fzf.sh | 25 |
1 files changed, 24 insertions, 1 deletions
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 <c@cjennings.net> # 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 +} |
