os/pkgs/notes.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
571 B
Nix
Raw Normal View History

2023-01-28 20:49:10 +00:00
self: with self; ''
#
# rg recursively through notes
#
# uses ripgrep: https://github.com/BurntSushi/ripgrep
NOTESDIR=~/pub.solar-nc/Notes
2024-08-27 11:31:31 +00:00
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"
''