X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/ef44c9e7fc839bec7bb17f8264442912f38c903c..917624e16c47de87c2adcacd08bc9472f718ec12:/ftplugin/markdown.vim?ds=inline diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim index 9b98767..f68e54c 100644 --- a/ftplugin/markdown.vim +++ b/ftplugin/markdown.vim @@ -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