mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-26 13:05:37 +00:00
new notes journal system
This commit is contained in:
parent
ec53a7ed7f
commit
c406979029
@ -2,39 +2,59 @@
|
|||||||
|
|
||||||
function notes --description "Notes functions"
|
function notes --description "Notes functions"
|
||||||
|
|
||||||
|
set -g NOTES_PATH $HOME/Documents/notes
|
||||||
|
|
||||||
|
function note_dates
|
||||||
|
set -g TODAY_NOTE (date +"%Y-%m-%d_%a")
|
||||||
|
set -g YESTERDAY_NOTE (date -jv "-1d" +"%Y-%m-%d_%a")
|
||||||
|
set -g TOMORROW_NOTE (date -jv "+1d" +"%Y-%m-%d_%a")
|
||||||
|
end
|
||||||
|
|
||||||
|
function note_header
|
||||||
|
set -g CURRENT_WEATHER (curl -s "https://wttr.in/?format=1")
|
||||||
|
set -g JOURNAL_HEADER "[[$YESTERDAY_NOTE]] | [[home]] | [[$TOMORROW_NOTE]]\n\n---\n\n$CURRENT_WEATHER\n\n# Today's Goals\n\n\n# Journal\n\n"
|
||||||
|
end
|
||||||
|
|
||||||
function journal --description "Create today's journal"
|
function journal --description "Create today's journal"
|
||||||
set today (date -j +"%Y-%m-%d_%a")
|
note_dates
|
||||||
set today_journal $HOME/Documents/notes/$today.md
|
if [ -f $NOTES_PATH/$TODAY_NOTE.md ]
|
||||||
if [ -f $today_journal ]
|
|
||||||
echo "Already exists."
|
echo "Already exists."
|
||||||
else
|
else
|
||||||
set yesterday (date -jv "-1d" +"%Y-%m-%d_%a")
|
note_header
|
||||||
set tomorrow (date -jv "+1d" +"%Y-%m-%d_%a")
|
echo $JOURNAL_HEADER > $NOTES_PATH/$TODAY_NOTE.md
|
||||||
set weather (curl -s "https://wttr.in/?format=1")
|
|
||||||
printf "[[$yesterday|Previous]] - [[calendar|Index]] - [[$tomorrow|Next]]\n\n---\n\n$weather\n\n# Tasks\n\n![[🎯 Active Tasks]]\n# Log\n\n\n# Communication\n\n---\n\n# Meetings\n\n" > $today_journal
|
|
||||||
echo "New journal added."
|
echo "New journal added."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function today --description "Open today's journal"
|
function today --description "Open today's journal"
|
||||||
cd $HOME/Documents/notes
|
set current_dir $PWD
|
||||||
set today (date -j +"%Y-%m-%d_%a")
|
cd $NOTES_PATH
|
||||||
set today_journal $today.md
|
note_dates
|
||||||
if [ -f $today_journal ]
|
if [ -f $TODAY_NOTE.md ]
|
||||||
vim $today_journal
|
vim $TODAY_NOTE.md
|
||||||
else
|
else
|
||||||
set yesterday (date -jv "-1d" +"%Y-%m-%d_%a")
|
note_header
|
||||||
set tomorrow (date -jv "+1d" +"%Y-%m-%d_%a")
|
echo $JOURNAL_HEADER > $TODAY_NOTE.md
|
||||||
set weather (curl -s "https://wttr.in/?format=1")
|
|
||||||
printf "[[$yesterday|Previous]] - [[calendar|Index]] - [[$tomorrow|Next]]\n\n---\n\n$weather\n\n# Tasks\n\n![[🎯 Active Tasks]]\n# Log\n\n\n# Communication\n\n---\n\n# Meetings\n\n" > $today_journal
|
|
||||||
echo "New journal added."
|
echo "New journal added."
|
||||||
vim $today_journal
|
vim $TODAY_NOTE.md
|
||||||
end
|
end
|
||||||
cd -
|
cd $current_dir
|
||||||
|
end
|
||||||
|
|
||||||
|
function meeting --description "Describe a meeting" -a "name"
|
||||||
|
note_dates
|
||||||
|
set today_date (date -j +"%Y-%m-%d")
|
||||||
|
set time (date +"%I:%M%p" | tr '[:upper:]' '[:lower:]')
|
||||||
|
set meeting_name (echo $name | tr ' ' '-' | tr '[:upper:]' '[:lower:]')
|
||||||
|
set meeting_note $today_date-$meeting_name
|
||||||
|
printf "[[$TODAY_NOTE]] | #meeting\n\n# $name\n\n---\n\n" > $NOTES_PATH/$meeting_note.md
|
||||||
|
printf "\n\n---\n\n$time - [[$meeting_note]]\n\n---\n\n" >> $NOTES_PATH/$TODAY_NOTE.md
|
||||||
|
open "obsidian://open?vault=notes&file=$meeting_note"
|
||||||
end
|
end
|
||||||
|
|
||||||
function note --description "Edit or create a note" -a "filename"
|
function note --description "Edit or create a note" -a "filename"
|
||||||
cd $HOME/Documents/notes
|
set current_dir $PWD
|
||||||
|
cd $NOTES_PATH
|
||||||
if test -n "$filename"
|
if test -n "$filename"
|
||||||
vim $filename.md
|
vim $filename.md
|
||||||
else
|
else
|
||||||
@ -43,17 +63,25 @@ function notes --description "Notes functions"
|
|||||||
vim $file
|
vim $file
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
cd -
|
cd $current_dir
|
||||||
|
end
|
||||||
|
|
||||||
|
abbr -a qn 'quicknote'
|
||||||
|
function quicknote --description "Write a quick note" -a "note"
|
||||||
|
note_dates
|
||||||
|
set time (date +"%I:%M%p" | tr '[:upper:]' '[:lower:]')
|
||||||
|
printf "\n\n---\n\n#### [[$TODAY_NOTE]] at $time\n$note\n" >> $NOTES_PATH/quick-notes.md
|
||||||
end
|
end
|
||||||
|
|
||||||
abbr -a sn 'syncnotes'
|
abbr -a sn 'syncnotes'
|
||||||
function syncnotes --description "Full git commit on notes"
|
function syncnotes --description "Full git commit on notes"
|
||||||
cd $HOME/Documents/notes
|
set current_dir $PWD
|
||||||
|
cd $NOTES_PATH
|
||||||
git pull
|
git pull
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "autosync"
|
git commit -m "autosync"
|
||||||
git push
|
git push
|
||||||
cd -
|
cd $current_dir
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user