forked from pub-solar/os
pkgs: add notes command
Inspiration: https://fedops.codeberg.page/note-taking-and-searching.html
This commit is contained in:
parent
40240e9d5c
commit
bf30ff4396
|
@ -33,6 +33,7 @@ in
|
|||
glow
|
||||
mdbook-multilang
|
||||
nnn
|
||||
notes
|
||||
powerline
|
||||
python-wiki-fetch
|
||||
silver-searcher
|
||||
|
|
|
@ -9,6 +9,7 @@ with final; {
|
|||
mailto-mutt = writeShellScriptBin "mailto-mutt" (import ./mailto-mutt.nix final);
|
||||
mopidy-jellyfin = import ./mopidy-jellyfin.nix final;
|
||||
mu = writeShellScriptBin "mu" (import ./mu.nix final);
|
||||
notes = writeShellScriptBin "notes" (import ./notes.nix final);
|
||||
psos = writeShellScriptBin "psos" (import ./psos.nix final);
|
||||
s = writeShellScriptBin "s" (import ./s.nix final);
|
||||
sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final);
|
||||
|
|
19
pkgs/notes.nix
Normal file
19
pkgs/notes.nix
Normal 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"
|
||||
''
|
Loading…
Reference in a new issue