Improve markdown folding & syntax highlights

This commit is contained in:
Kenneth Benzie 2016-09-07 23:57:41 +01:00
parent 042b8fb304
commit 2c2ed3c099
2 changed files with 30 additions and 3 deletions

View File

@ -3,6 +3,36 @@ if !has("win32") || has("gui_running")
setlocal spell
endif
setlocal foldmethod=expr
setlocal foldexpr=MarkdownFold(v:lnum)
function! MarkdownFold(lnum)
let l:line = getline(a:lnum)
if match(l:line, '^######.*$') == 0
return '>6'
elseif match(l:line, '^#####.*$') == 0
return '>5'
elseif match(l:line, '^####.*$') == 0
return '>4'
elseif match(l:line, '^###.*$') == 0
return '>3'
elseif match(l:line, '^##.*$') == 0
return '>2'
elseif match(l:line, '^#.*$') == 0
return '>1'
endif
return '='
endfunction
hi link markdownCode Special
hi link markdownCodeDelimiter PreProc
hi link markdownHeadingDelimiter Statement
hi link markdownLinkDelimiter PreProc
hi link markdownLinkTextDelimiter PreProc
hi link markdownUrl Include
" Max 80 chars wide.
setlocal textwidth=80
" Use tabwidth of 4 to be markdown complient.

3
vimrc
View File

@ -157,9 +157,6 @@ let g:DoxygenToolkit_commentType="C++"
" markdown live browser preview
Plug 'suan/vim-instant-markdown'
" markdown folding
Plug 'nelstrom/vim-markdown-folding'
let g:markdown_fenced_languages=['cpp', 'c', 'cmake', 'sh', 'vim', 'python']
" SimplyFold - python folding