os/pkgs/notes.nix

21 lines
517 B
Nix
Raw Normal View History

2023-01-28 20:49:10 +00:00
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"
''