From f8140b5febc0caf2323423d42fe794c9cfa58862 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Wed, 23 Apr 2025 15:00:05 -0400 Subject: [PATCH] AutoYADM commit: 2025-04-23 15:00:05 --- .config/fish/functions/jrnl.fish | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.config/fish/functions/jrnl.fish b/.config/fish/functions/jrnl.fish index 743fec3e..3848b5b9 100644 --- a/.config/fish/functions/jrnl.fish +++ b/.config/fish/functions/jrnl.fish @@ -41,7 +41,7 @@ function jrnl --description 'Lightweight journaling tool' end - set -f jdir ~/jrnl + set -g jdir ~/jrnl if set -ql _flag_dir[1] set jdir $_flag_dir[1] else if set -q jrnl_directory @@ -59,6 +59,10 @@ function jrnl --description 'Lightweight journaling tool' set template $jrnl_template end set -f template_base (path basename $template) + function edit -a targ + set -l cmd (string split ' ' -- $EDITOR) + env -C $jdir $cmd $targ + end if not test -f $template # first check if template exists in jdir @@ -81,7 +85,7 @@ function jrnl --description 'Lightweight journaling tool' echo echo 'Today is %{date_long}.' end >$template - eval $EDITOR $template + edit $template set -q _flag_e; and return 0 break case n N @@ -91,7 +95,7 @@ function jrnl --description 'Lightweight journaling tool' end end if set -q _flag_e - eval $EDITOR $template + edit $template return 0 end @@ -112,13 +116,13 @@ function jrnl --description 'Lightweight journaling tool' printf "\033[1A\033[2K" switch $response case y Y - eval $EDITOR $entry + edit $entry break case n N break end end else - eval $EDITOR $entry + edit $entry end end