commit 3c638eb252e08b40db327775ff7d9907e65bc1ca
parent c81b16ace19981506e4c690cf1e30e964691b0b8
Author: Chris Bracken <chris@bracken.jp>
Date: Tue, 24 May 2022 22:45:18 -0700
Always use markdown syntax for files ending in md
When setting the wiki `syntax` config option to 'markdown', vimwiki
creates files with extension 'md' but doesn't actually set the vim
syntax to markdown. This forces vim to always set the syntax to
markdown for files with a .md extension, whether or not they're part of
a vimwiki wiki.
See: https://www.reddit.com/r/vim/comments/esgog5/vimwiki_and_markdown_syntax/
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/vimrc b/vimrc
@@ -146,6 +146,10 @@ nmap <leader>jd <Plug>VimwikiDiaryIndex
nmap <leader>jn <Plug>VimwikiMakeDiaryNote
nmap <leader>jg :VimwikiGoto
+" Use markdown syntax highlighting in vimwiki.
+" By default it wants to set syntax=vimwiki even for files with extension md.
+au BufEnter,InsertLeave *.md setlocal syntax=markdown
+
" Wiki diary previous, next day.
au FileType vimwiki nmap <leader>dp <Plug>VimwikiDiaryPrevDay
au FileType vimwiki nmap <leader>dn <Plug>VimwikiDiaryNextDay