commit acc837cbd7d011eec24427dca18c409813a5e925
parent 846cc522c1ecedba156d9bad20777cb3271bc468
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/.vim/vimrc b/.vim/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