Add notetaker
script
Add a script to quickly and easily create and edit a daily note.
This commit is contained in:
parent
c7ca1fd14c
commit
c2ead888dd
|
@ -6,11 +6,13 @@ let
|
||||||
inherit (pkgs) writeShellApplication;
|
inherit (pkgs) writeShellApplication;
|
||||||
|
|
||||||
scripts = {
|
scripts = {
|
||||||
|
notetaker = writeShellApplication (import ./scripts/notetaker.nix);
|
||||||
t = writeShellApplication (import ./scripts/t.nix { inherit pkgs; });
|
t = writeShellApplication (import ./scripts/t.nix { inherit pkgs; });
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
with pkgs;
|
with pkgs;
|
||||||
[
|
[
|
||||||
|
scripts.notetaker
|
||||||
scripts.t
|
scripts.t
|
||||||
|
|
||||||
awscli2
|
awscli2
|
||||||
|
|
25
lib/shared/scripts/notetaker.nix
Normal file
25
lib/shared/scripts/notetaker.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
name = "notetaker";
|
||||||
|
|
||||||
|
runtimeInputs = [ ];
|
||||||
|
|
||||||
|
text = ''
|
||||||
|
# Based on https://github.com/CalinLeafshade/dots/blob/fe685d45201f267829b75fe5ca7e3da9d4aa4c02/bin/bin/notetaker.
|
||||||
|
|
||||||
|
today="$(date +%Y-%m-%d)"
|
||||||
|
note_path="''${NOTES_PATH:-$HOME/Documents/wiki}"
|
||||||
|
note_filename="$note_path/daily-notes/$(date +%Y)/$(date +%m)/$today.md"
|
||||||
|
|
||||||
|
if [[ ! -f "$note_filename" ]]; then
|
||||||
|
mkdir -p "$(dirname "$note_filename")"
|
||||||
|
|
||||||
|
echo "# $today" > "$note_filename"
|
||||||
|
fi
|
||||||
|
|
||||||
|
nvim -c "normal Go" \
|
||||||
|
-c "normal Go## $(date +%H:%M)" \
|
||||||
|
-c "normal G2o" \
|
||||||
|
-c "normal zz" \
|
||||||
|
-c "startinsert" "$note_filename"
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue