From: Hiroshi Shirosaki Date: Mon, 16 Nov 2015 06:43:39 +0000 (+0900) Subject: Fix indent with syntax off X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/642730fccce7e78c995389f3c430747d266efa96?hp=67b59d559bafc505b0a75425a50149b6025566fc Fix indent with syntax off Move indent related settings from syntax to index. Fix #126 --- diff --git a/indent/markdown.vim b/indent/markdown.vim index fb8d95d..23944f2 100755 --- a/indent/markdown.vim +++ b/indent/markdown.vim @@ -5,6 +5,16 @@ setlocal indentexpr=GetMarkdownIndent() setlocal nolisp setlocal autoindent +" Automatically insert bullets +setlocal formatoptions+=r +" Do not automatically insert bullets when auto-wrapping with text-width +setlocal formatoptions-=c +" Accept various markers as bullets +setlocal comments=b:*,b:+,b:- + +" Automatically continue blockquote on line break +setlocal comments+=b:> + " Only define the function once if exists("*GetMarkdownIndent") | finish | endif diff --git a/syntax/markdown.vim b/syntax/markdown.vim index 60a675d..bacb5a1 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -130,16 +130,6 @@ HtmlHiLink mkdLinkTitle htmlString HtmlHiLink mkdMath Statement HtmlHiLink mkdDelimiter Delimiter -" Automatically insert bullets -setlocal formatoptions+=r -" Do not automatically insert bullets when auto-wrapping with text-width -setlocal formatoptions-=c -" Accept various markers as bullets -setlocal comments=b:*,b:+,b:- - -" Automatically continue blockquote on line break -setlocal comments+=b:> - let b:current_syntax = "mkd" delcommand HtmlHiLink diff --git a/test/indent.vader b/test/indent.vader new file mode 100644 index 0000000..76f4990 --- /dev/null +++ b/test/indent.vader @@ -0,0 +1,24 @@ +Given markdown; +* item1 + +Do (Insert enter at list end): + A\item2 + +Expect (auto insert * and indent level is same): + * item1 + * item2 + +Given markdown; + +Execute: + syntax off + +Do (Insert enter at list end with syntax off): + i* item1\item2 + +Expect (auto insert * and indent level is same): + * item1 + * item2 + +Execute: + syntax on