Skip to content
Snippets Groups Projects
Commit 7221629d authored by Sven Mäder's avatar Sven Mäder :speech_balloon:
Browse files

Add custom markdown folding rda

parent 6be2c082
No related branches found
No related tags found
No related merge requests found
...@@ -241,7 +241,7 @@ au filetype markdown syntax match RedTodo /TODO/ ...@@ -241,7 +241,7 @@ au filetype markdown syntax match RedTodo /TODO/
let g:markdown_folding = 1 let g:markdown_folding = 1
au filetype markdown setlocal foldlevel=1 au filetype markdown setlocal foldlevel=1
let g:markdown_fenced_languages = ['ruby', 'perl', 'bash=sh', 'sh', 'vim', 'html', 'javascript', 'css', 'python'] let g:markdown_fenced_languages = ['ruby', 'perl', 'bash=sh', 'sh', 'vim', 'html', 'javascript', 'css', 'python', 'yaml']
let g:markdown_minlines = 100 "synchronize syntax highlighting with more lines (default:50) let g:markdown_minlines = 100 "synchronize syntax highlighting with more lines (default:50)
""Enable concealing of links (https://github.com/tpope/vim-markdown/pull/9/commits/44dec444c959fa57c2fc835980ad15dbbbf11d1c) ""Enable concealing of links (https://github.com/tpope/vim-markdown/pull/9/commits/44dec444c959fa57c2fc835980ad15dbbbf11d1c)
...@@ -249,6 +249,28 @@ let g:markdown_minlines = 100 "synchronize syntax highlighting with more l ...@@ -249,6 +249,28 @@ let g:markdown_minlines = 100 "synchronize syntax highlighting with more l
"au filetype markdown syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained conceal "au filetype markdown syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained conceal
"au filetype markdown syn region markdownId matchgroup=markdownIdDelimiter start="\s*\[" end="\]" keepend contained conceal "au filetype markdown syn region markdownId matchgroup=markdownIdDelimiter start="\s*\[" end="\]" keepend contained conceal
"au filetype markdown syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline concealends "au filetype markdown syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline concealends
"Custom markdown folding
au filetype markdown setlocal foldexpr=MyMarkdownFold()
au filetype markdown setlocal foldmethod=expr
au filetype markdown setlocal foldlevel=1
function! MyMarkdownFold()
let line = getline(v:lnum)
" regular headers
let depth = match(line, '\(^##\+\)\@<=\( .*$\)\@=')
if depth > 0
return ">" . depth
endif
" setext headers
let nextline = getline(v:lnum + 1)
if (line =~ '^.\+$') && (nextline =~ '^=\+$')
return ">1"
endif
if (line =~ '^.\+$') && (nextline =~ '^-\+$')
return ">2"
endif
return "="
endfunction
"}}} "}}}
" --- ansible ---{{{ " --- ansible ---{{{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment