summaryrefslogtreecommitdiff
path: root/dotfiles/system/.profile.d/fzf.sh
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-05-18 10:49:49 -0500
committerCraig Jennings <c@cjennings.net>2025-05-18 10:49:49 -0500
commitf88bbe3d04b8535e4ef1042c26724e5065e24447 (patch)
tree7e1778f3c1684b3d3bd864b232d7896e22dd37e5 /dotfiles/system/.profile.d/fzf.sh
parent59509c366af5449be0b62a5bb23ae5026cba02d3 (diff)
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
Diffstat (limited to 'dotfiles/system/.profile.d/fzf.sh')
-rw-r--r--dotfiles/system/.profile.d/fzf.sh25
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
+}