Blame


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