Blob


1 # NOte Find
3 A simple script to filter notes with fzf and open them in mg(1).
5 => https://gist.github.com/benevidesh/d78f7681120a13d5386ea55b39d82c9b Inspired by a gist
7 cd ~/notes || exit 1
9 I store all the notes here, but die quickly should that directory not
10 exists.
12 grep '^# ' * | \
13 sed -e 's/:# / | /1' | \
14 fzf --tac --multi --layout=reverse \
15 --preview "echo {} | sed 's/ .*//g' | xargs cat" | \
16 while read l; do
17 xargs -o mg -- "${l%% *}" </dev/null;
19 I prefer this over binding enter in fzf. `xargs -o' re-opens /dev/tty
20 so mg works.
22 The fancy `${l%% *}' thingy is just to select only the filename (i.e.
23 everything until the first space) and discard the rest of the line (the
24 title.)
26 done