From 82ced930ae169ee276b85db716fb8d1e24dd53eb Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Fri, 25 Jul 2014 13:15:17 +0200 Subject: [PATCH 1/1] Fix header increase and decrease. --- ftplugin/mkd.vim | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ftplugin/mkd.vim b/ftplugin/mkd.vim index 4744512..dfb5546 100644 --- a/ftplugin/mkd.vim +++ b/ftplugin/mkd.vim @@ -47,12 +47,12 @@ " For each level, contains the regexp that matches at that level only. let s:levelRegexpDict = { - \ 1: '\v^(#[^#]|.+\n\=+$)', - \ 2: '\v^(##[^#]|.+\n-+$)', - \ 3: '\v^###[^#]', - \ 4: '\v^####[^#]', - \ 5: '\v^#####[^#]', - \ 6: '\v^######[^#]' + \ 1: '\v^(#[^#]@=|.+\n\=+$)', + \ 2: '\v^(##[^#]@=|.+\n-+$)', + \ 3: '\v^###[^#]@=', + \ 4: '\v^####[^#]@=', + \ 5: '\v^#####[^#]@=', + \ 6: '\v^######[^#]@=' \ } " Maches any header level of any type. @@ -392,7 +392,7 @@ function! s:HeaderDecrease(line1, line2, ...) endfor let l:numSubstitutions = s:SetexToAtx(a:line1, a:line2) 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) . '\1/g' + execute 'silent! ' . a:line1 . ',' . (a:line2 - l:numSubstitutions) . 'substitute/' . s:levelRegexpDict[l:level] . '/' . repeat('#', l:level + l:levelDelta) . '/g' endfor endfunction -- 2.39.2