From: Hiroshi Shirosaki Date: Mon, 25 Jan 2016 01:02:41 +0000 (+0900) Subject: No autoindent after the list X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/51d98df7639dda404c5fe4c154716fdf81b1899a?ds=sidebyside No autoindent after the list Fix #198 --- diff --git a/indent/markdown.vim b/indent/markdown.vim index e21f287..b38a37c 100755 --- a/indent/markdown.vim +++ b/indent/markdown.vim @@ -41,6 +41,9 @@ function! s:prevnonblank(lnum) endfunction function GetMarkdownIndent() + if v:lnum > 2 && s:is_blank_line(getline(v:lnum - 1)) && s:is_blank_line(getline(v:lnum - 2)) + return 0 + endif let list_ind = 4 " Find a non-blank line above the current line. let lnum = prevnonblank(v:lnum - 1) diff --git a/test/indent.vader b/test/indent.vader index 3cc5010..aabf54f 100644 --- a/test/indent.vader +++ b/test/indent.vader @@ -2,7 +2,7 @@ Given markdown; * item1 Do (insert enter at list end): - A\item2 + A\item2 Expect (auto insert * and indent level is same): * item1 @@ -14,7 +14,7 @@ Execute: syntax off Do (insert enter at list end with syntax off): - i* item1\item2 + i* item1\item2 Expect (auto insert * and indent level is same): * item1 @@ -34,3 +34,17 @@ Expect (no autoindent in code block): ``` * item1 text + +Given markdown; +* item1 + +a + +Do (insert enter after list): + jji\b + +Expect (no autoindent outside list): + * item1 + + + ba