dotfiles/fish.configlink/functions/notes.fish

50 lines
1.7 KiB
Fish
Raw Normal View History

2020-07-27 17:00:26 +00:00
#!/usr/local/bin/fish
function notes --description "Notes functions"
function journal --description "Create today's journal"
set today (date -j +"%Y-%m-%d_%a")
2020-08-01 01:00:49 +00:00
set today_journal $HOME/Documents/notes/$today.md
2020-07-27 17:00:26 +00:00
if [ -f $today_journal ]
echo "Already exists."
else
set yesterday (date -jv "-1d" +"%Y-%m-%d_%a")
set tomorrow (date -jv "+1d" +"%Y-%m-%d_%a")
2020-08-02 14:20:25 +00:00
set weather (curl -s "https://wttr.in/?format=1")
2020-08-02 14:21:35 +00:00
printf "[[$yesterday|Previous]] - [[calendar|Index]] - [[$tomorrow|Next]]\n\n---\n\n$weather\n\n# Tasks\n\n\n# Log\n\n\n# Communication\n\n---\n\n# Meetings\n\n" > $today_journal
2020-07-27 17:00:26 +00:00
echo "New journal added."
end
end
2020-07-31 13:28:30 +00:00
function today --description "Open today's journal"
2020-08-01 13:46:48 +00:00
cd $HOME/Documents/notes
2020-07-31 13:28:30 +00:00
set today (date -j +"%Y-%m-%d_%a")
2020-08-01 13:46:48 +00:00
set today_journal $today.md
2020-07-31 13:28:30 +00:00
if [ -f $today_journal ]
vim $today_journal
else
set yesterday (date -jv "-1d" +"%Y-%m-%d_%a")
set tomorrow (date -jv "+1d" +"%Y-%m-%d_%a")
2020-08-02 14:20:25 +00:00
set weather (curl -s "https://wttr.in/?format=1")
2020-08-02 14:21:35 +00:00
printf "[[$yesterday|Previous]] - [[calendar|Index]] - [[$tomorrow|Next]]\n\n---\n\n$weather\n\n# Tasks\n\n\n# Log\n\n\n# Communication\n\n---\n\n# Meetings\n\n" > $today_journal
2020-07-31 13:28:30 +00:00
echo "New journal added."
vim $today_journal
end
2020-08-01 13:46:48 +00:00
cd -
2020-07-31 13:28:30 +00:00
end
function wiki --description "Open vimwiki file"
2020-08-01 13:46:48 +00:00
cd $HOME/Documents/notes
set file (ls | fzf)
2020-07-31 13:28:30 +00:00
if [ $status -eq 0 ]
vim $file
end
2020-08-01 13:46:48 +00:00
cd -
2020-07-31 13:28:30 +00:00
end
function note --description "Edit or create a note"
vim ~/Documents/notes/$argv[1].md
end
2020-07-27 17:00:26 +00:00
end