So based on the keystrokes I enter I want to copy the full file templates into the new file and begin editing them. This is my vimscript and I have tried a couple of different ways, from using :r :e into my function but that did not seem to load the file. I've outlined some of my attempts below and I even tried making a vim/templates folder and using it for all .md files but that didn't seem to work. I am on OsX Catilina.
Is there a way to open a file copy as a buffer like this? I'm ok writing the buffer to disk too.
function NewzZettel(arg) let new = g:zettelkasten . strftime("%Y%m%d%H%M") . "-" arg ".md" let template = g:zettlekasten . "zettel.md" let data = readfile(template) "Attempt1 if writefile(data, new) echomsg 'write error' endif "Attempt 2 if has("autocmd") augroup templates autocmd BufNewFile *.md 0r template echo BugNewFile augroup END endif " Attempt 3 augroup templates au! " read in template files autocmd BufNewFile *.* silent! execute '0r $HOME/vim/templates/note.'.expand("<afile>:e") augroup END au BufNewFile *.md 0r ~/Users/User/Nextcloud/Notes/mynotes/note_template.md endfunction