X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/5ff124014066ba7882617c283e7750d449caafb4..87633369306b4872c652faa56049a95660287047:/ftplugin/markdown.vim diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim index 9b98767..7eb5784 100644 --- a/ftplugin/markdown.vim +++ b/ftplugin/markdown.vim @@ -330,7 +330,7 @@ function! s:Toc(...) let d.text = substitute(d.text, '\v[ ]*#*$', '', '') " setex headers else - let l:next_line = getbufline(bufname(d.bufnr), d.lnum+1) + let l:next_line = getbufline(d.bufnr, d.lnum+1) if match(l:next_line, "=") > -1 let l:level = 0 elseif match(l:next_line, "-") > -1 @@ -381,8 +381,9 @@ function! s:HeaderDecrease(line1, line2, ...) endif endfor let l:numSubstitutions = s:SetexToAtx(a:line1, a:line2) + let l:flags = (&gdefault ? '' : 'g') for l:level in range(replaceLevels[0], replaceLevels[1], -l:levelDelta) - execute 'silent! ' . a:line1 . ',' . (a:line2 - l:numSubstitutions) . 'substitute/' . s:levelRegexpDict[l:level] . '/' . repeat('#', l:level + l:levelDelta) . '/g' + execute 'silent! ' . a:line1 . ',' . (a:line2 - l:numSubstitutions) . 'substitute/' . s:levelRegexpDict[l:level] . '/' . repeat('#', l:level + l:levelDelta) . '/' . l:flags endfor endfunction @@ -398,9 +399,10 @@ function! s:TableFormat() normal! j " Remove everything that is not a pipe othewise well formated tables would grow " because of addition of 2 spaces on the separator line by Tabularize /|. - s/[^|]//g + let l:flags = (&gdefault ? '' : 'g') + execute 's/[^|]//' . l:flags Tabularize /| - s/ /-/g + execute 's/ /-/' . l:flags call setpos('.', l:pos) endfunction