From: Hiroshi Shirosaki Date: Wed, 20 Jan 2016 05:53:09 +0000 (+0900) Subject: Fix indent code block at beginning of file X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/1509003ccdff6bf1f7777ceefc09f9cb32abf986 Fix indent code block at beginning of file Fix #105 --- diff --git a/syntax/markdown.vim b/syntax/markdown.vim index 92c6c56..79e1a3c 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -96,6 +96,7 @@ syn region mkdCode start="]*>" end="" syn region mkdCode start="]*>" end="" syn region mkdFootnote start="\[^" end="\]" syn match mkdCode /^\s*\n\(\(\s\{8,}[^ ]\|\t\t\+[^\t]\).*\n\)\+/ +syn match mkdCode /\%^\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ contained syn region mkdListItemLine matchgroup=mkdListItem start="^\s*\%([-*+]\|\d\+\.\)\s\+" end="$" contains=@mkdNonListItem,@Spell syn region mkdNonListItemBlock start="\(\%^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@!\|\n\(\_^\_$\|\s\{4,}[^ ]\|\t+[^\t]\)\@!\)" end="^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@=" contains=@mkdNonListItem,@Spell diff --git a/test/syntax.vader b/test/syntax.vader index c438dad..b5d1937 100644 --- a/test/syntax.vader +++ b/test/syntax.vader @@ -263,6 +263,14 @@ Execute (indent code blocks after list): AssertNotEqual SyntaxOf('b'), 'mkdCode' AssertEqual SyntaxOf('c'), 'mkdCode' +Given markdown; + a + b + +Execute (indent code block at beginning of file): + AssertEqual SyntaxOf('a'), 'mkdCode' + AssertEqual SyntaxOf('b'), 'mkdCode' + Given markdown; ```c++ #include