os/pkgs/notes.nix

20 lines
566 B
Nix

self: with self; ''
#
# rg recursively through notes
#
# uses ripgrep: https://github.com/BurntSushi/ripgrep
NOTESDIR=~/pub.solar-nc/Notes
ACK_PREFIX="${rg}/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"
''