From 79c82e61f8522da09554a63f6a97b33341f5b802 Mon Sep 17 00:00:00 2001 From: "chawley (chawley)" Date: Wed, 9 Oct 2019 16:36:13 -0400 Subject: [PATCH] Modified .vimrc and `md` template to match new markdown format I started using Visual Studio Code for markdown notes and I'm trying to keep the markdown files as agnostic as possible. Vim will now match the frontmatter style of VSC and (to an extent) Notable --- .vim/templates/md | 21 +++++++++++---------- .vimrc | 6 ++++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.vim/templates/md b/.vim/templates/md index aca8638..eb2fc20 100644 --- a/.vim/templates/md +++ b/.vim/templates/md @@ -1,16 +1,17 @@ :insert +--- -# Title - -Created: - -Updated: - -## Summary - - +tags: [ untagged ] +title: +created: --- -## Reference(s): +# Title + +## Summary + +___ + +## Reference(s) diff --git a/.vimrc b/.vimrc index 3efdbc7..6786ec7 100644 --- a/.vimrc +++ b/.vimrc @@ -251,9 +251,11 @@ autocmd bufWritePost,filewritepost *.py execute "normal `a" " ==> Templates: markdown documents (.md, .mkd) autocmd BufNewFile *.md,*.mkd so $HOME/.vim/templates/md -autocmd BufNewFile *.md,*.mkd exe "g/Created:.*/s//Created: " .strftime("%c") +autocmd BufNewFile *.md,*.mkd %s/title:.*/\='title: '.expand('%:r')/e +autocmd BufNewFile *.md,*.mkd %s/\# Title.*/\='# '.expand('%:r')/e +autocmd BufNewFile *.md,*.mkd exe "g/created:.*/s//created: " .strftime("%c") autocmd BufWritePre,filewritepre *.md,*.mkd execute "normal ma" -autocmd BufWritePre,filewritepre *.md,*.mkd exe "g/Updated:.*/s//Updated: " .strftime("%c") +"autocmd BufWritePre,filewritepre *.md,*.mkd exe "g/Updated:.*/s//Updated: " .strftime("%c") autocmd bufWritePost,filewritepost *.md,*.mkd execute "normal `a" " ---------------------------------------------------------------------------------------------------------------------