diff --git a/.config/fish/functions/jrnl.fish b/.config/fish/functions/jrnl.fish index af30b164..558db3d5 100644 --- a/.config/fish/functions/jrnl.fish +++ b/.config/fish/functions/jrnl.fish @@ -89,7 +89,13 @@ function jrnl --description 'Lightweight journaling tool' set entry "$jdir/$today.md" # check if journal entry exists if not test -f $entry - set contents (string join \n "# $today" "$(tail -n +2 $template)" | string collect -N) + set contents (cat $template | \ + string match --invert --regex '^' | \ + string replace --all '%{date}' "$(date +'%A, %b %d, %Y')" | \ + string collect -N) + echo $contents + return 0 + # set contents (string join \n "# $today" "$(tail -n +2 $template)" | string collect -N) cat $template >$entry set -l prompt "Created $entry, open in $EDITOR? (y/n)" while read --nchars 1 -l response --prompt-str="$prompt" or return 1