X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/8d3d1132bfd271842f1da6835bc22a9f1efc1012..e1d8331302bfcd52dc6744a713dab2f79643e182:/indent/markdown.vim?ds=sidebyside diff --git a/indent/markdown.vim b/indent/markdown.vim index 540bc04..faa7629 100755 --- a/indent/markdown.vim +++ b/indent/markdown.vim @@ -28,6 +28,10 @@ function! s:IsLiStart(line) \ a:line =~ '^\s*[*+-] \+' endfunction +function! s:IsHeaderLine(line) + return a:line =~ '^\s*#' +endfunction + function! s:IsBlankLine(line) return a:line =~ '^$' endfunction @@ -55,6 +59,9 @@ function GetMarkdownIndent() if s:IsLiStart(cline) " Current line is the first line of a list item, do not change indent return indent(v:lnum) + elseif s:IsHeaderLine(cline) && !s:IsMkdCode(v:lnum) + " Current line is the header, do not indent + return 0 elseif s:IsLiStart(line) if s:IsMkdCode(lnum) return ind