Minimum Viable Note Taking in Vim

let g:notes = "/Users/michael/wiki/"
function! NoteExists(filename)
 if !empty(glob(g:notes . "*" . a:filename . "*", 1))
   return 1
 endif
endfunction

function! CreateNote(filename)
 if(NoteExists(a:filename))
   execute ":e " . glob(g:notes . "*" . a:filename . "*", 1)
 else
   execute "!echo '\\# " . a:filename . "' > '" . g:notes . strftime("%Y%m%d%H%M") . " " . a:filename . ".md'"
   execute ":e " . g:notes . strftime("%Y%m%d%H%M") . " " . a:filename . ".md"
 endif
endfunction

command! -nargs=1 NewNote :call CreateNote(<f-args>)
nnoremap <leader>nn :NewNote
nnoremap <leader>nd :call CreateNote("Daily Note " . strftime("%Y-%m-%d"))<CR>

Open all daily notes in one long document (descending order)

find ~/wiki -name "*Daily Note*" | sort -r | xargs -I "{}" cat "{}" | vim -