os/pkgs/notes.nix
2024-08-27 13:31:31 +02:00

20 lines
571 B
Nix

self: with self; ''
#
# rg recursively through notes
#
# uses ripgrep: https://github.com/BurntSushi/ripgrep
NOTESDIR=~/pub.solar-nc/Notes
ACK_PREFIX="${ripgrep}/bin/rg --files-with-matches"
cd $NOTESDIR || exit
file="$(
FZF_DEFAULT_COMMAND="$ACK_PREFIX '$1'" \
${fzf}/bin/fzf --sort --preview="[[ ! -z {} ]] && ack --colour --context 5 {q} {}" \
--phony -q "$1" \
--bind "change:reload:$ACK_PREFIX {q}" \
--preview-window="70%:wrap"
)" &&
echo "opening $file" &&
${bat}/bin/bat --theme=TwoDark "$file"
''