os/pkgs/notes.nix
2023-01-28 21:49:10 +01:00

21 lines
517 B
Nix

self:
with self; ''
#
# ack recursively through notes
#
# uses ack: https://beyondgrep.com
NOTESDIR=~/pub.solar-nc/Notes
ACK_PREFIX="ack --files-with-matches"
cd $NOTESDIR || exit
file="$(
FZF_DEFAULT_COMMAND="$ACK_PREFIX '$1'" \
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 --theme=TwoDark "$file"
''