pkgs: add notes command

Inspiration: https://fedops.codeberg.page/note-taking-and-searching.html
This commit is contained in:
teutat3s 2022-07-07 22:16:55 +02:00
parent 40240e9d5c
commit bf30ff4396
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
3 changed files with 21 additions and 0 deletions

View file

@ -33,6 +33,7 @@ in
glow glow
mdbook-multilang mdbook-multilang
nnn nnn
notes
powerline powerline
python-wiki-fetch python-wiki-fetch
silver-searcher silver-searcher

View file

@ -9,6 +9,7 @@ with final; {
mailto-mutt = writeShellScriptBin "mailto-mutt" (import ./mailto-mutt.nix final); mailto-mutt = writeShellScriptBin "mailto-mutt" (import ./mailto-mutt.nix final);
mopidy-jellyfin = import ./mopidy-jellyfin.nix final; mopidy-jellyfin = import ./mopidy-jellyfin.nix final;
mu = writeShellScriptBin "mu" (import ./mu.nix final); mu = writeShellScriptBin "mu" (import ./mu.nix final);
notes = writeShellScriptBin "notes" (import ./notes.nix final);
psos = writeShellScriptBin "psos" (import ./psos.nix final); psos = writeShellScriptBin "psos" (import ./psos.nix final);
s = writeShellScriptBin "s" (import ./s.nix final); s = writeShellScriptBin "s" (import ./s.nix final);
sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final); sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final);

19
pkgs/notes.nix Normal file
View file

@ -0,0 +1,19 @@
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"
''