nvim: fix markdown fenced languages and add support for hugo front matter

This commit is contained in:
Grigory Shipunov 2020-10-05 09:44:08 +02:00
parent 33463777f2
commit a1e9cd412d
No known key found for this signature in database
GPG key ID: 77BB6C3E4771EE7C
2 changed files with 40 additions and 2 deletions

View file

@ -0,0 +1,39 @@
" Vim syntax file
" Language: markdown with embedded yaml, toml for Hugo
" Author: James Wright (james@jameswright.xyz)
" License: MIT
" Inspired by https://github.com/pbrisbin/vim-syntax-shakespeare/blob/master/after/syntax/haskell.vim
" store and remove current syntax value
if exists('b:current_syntax')
let old_syntax = b:current_syntax
unlet b:current_syntax
endif
syn include @yaml syntax/yaml.vim
unlet b:current_syntax
syn include @toml syntax/toml.vim
unlet b:current_syntax
if getline(1) =~ '---'
syn region yamlBlock matchgroup=quasiQuote start=/\%^---/ end=/^---/ contains=@yaml
elseif getline(1) =~ '+++'
syn region tomlBlock matchgroup=quasiQuote start=/\%^+++/ end=/^+++/ contains=@toml
endif
if version < 508
command! -nargs=+ HiLink hi link <args>
else
command! -nargs=+ HiLink hi def link <args>
endif
HiLink quasiQuote Boolean
delcommand HiLink
" restore current syntax value
if exists('old_syntax')
let b:current_syntax = old_syntax
endif

View file

@ -103,9 +103,8 @@ set updatetime=107
let g:linuxsty_patterns = ["/usr/src", "/linux", "~/git/linux", "~/devel/linux"]
" markdown
let g:markdown_folding = 1
let g:markdown_syntax_conceal = 0
let g:markdown_fenced_languages = ['C', 'html', 'python', 'scheme']
let g:markdown_fenced_languages = ['c', 'html', 'python', 'scheme']
" disable modelines
set nomodeline