alias jim=' \
journaldir="$HOME/journal" ; \
year="`date +%Y`" ; \
yearpath="$journaldir/$year" ; \
[[ -d "$yearpath" ]] || mkdir -p $yearpath ; \
jfile="log_`date -I`.md" ; \
jfilepath="$journaldir/$year/$jfile" ; \
header="# log_`date -I`\n\n# Highlights:\n\n" ; \
[[ -f "$jfilepath" ]] && echo "Opening log: $jfilepath" || { echo "Creating new log: $jfilepath" ; echo -e "$header" > $jfilepath ; } ; \
vi $jfilepath ; '
Copy this to your .bash_aliases file. It's fully automatic. It'll create the directories automatically.This will now create a /home/user/journal/YEAR/journalfile.md. It's now separated by year, so that you can run this forever, and have a maximum of 365 files per year directory.
This is a markdown file. And in the header variable, I had it fill in the new file with some basic headers. You can edit this yourself to add more.
Try it out, and let me know.
on macos
Try this instead. It works for me. Let me know.
Copy it to your ~/.bash_aliases. And source it.
alias jim='
function _jim() {
journaldir="$HOME/journal"
year=`date "+%Y"`
today=`date "+%Y-%m-%d"`
yearpath="$journaldir/$year"
[[ -d "$yearpath" ]] || mkdir -p $yearpath
jfile="log_$today.md"
jfilepath="$journaldir/$year/$jfile"
header="# Log: $today\n\n# Highlights:\n\n"
[[ -f "$jfilepath" ]] && echo "Opening log: $jfilepath" || { echo "Creating new log: $jfilepath" ; echo -e "$header" > $jfilepath ; }
vi "$jfilepath"
}; _jim' alias journal="vim ~/workspace/google-drive/journal/$(date "+%Y-%m")"
Then in vim I have this mapping, by pressing F2 it opens a new line at the end of the file so you can just start typing.
I add goals to the beggining of the week with the F3 map. nnoremap <F2> Go<NL><Esc>i<Esc>"=strftime("\%A, \%Y-\%m-\%d \%H:\%M:\%S")<CR>po -
nnoremap <F3> Go<NL><NL><Esc>iWeek <Esc>"=strftime("\%V ")<CR>p<Esc>i goals:<CR> -
Monday -> Press F3 -> like a bujo, review what is still relevant and move to next week or drop it. Week 10 goals:
- [ ] check connectivity with service x, splunk and service Y, from new environment
- [ ] xxxx
Then whenever I will change context in my mind I just go back to the open buffer and press F2.
I normally start my day looking at what happened over the other remote branches, and update my weekly goals task list Thursday, 2020-07-09 08:25:52
- emails / slack
Thursday, 2020-07-09 08:36:13
- support x person
Thursday, 2020-07-09 10:00:00
- dog break
Thursday, 2020-07-09 10:00:00
- HN
Then at then end of the year I create a folder `archive/201X/` and move all the files under it.I had a calendar event reminding me to review what happened over the week on Friday afternoon, but that is just lying to myself. I got to do once or twice over the last couple of years, that is something I need to improve on which is the whole point of article, review it while it is fresh and learn from it.
edit: code format
(1) Copy to your .bash_aliases file.
(2) Edit the journaldir, and replace myusername with your name.
(3) Create a journal directory somewhere for #2.
(4) Source it. source ~/.bash_aliases
(5) jim will open up today's note in Vi.
Try it out, and let me know.