From e3d40554006555322d611b0788b35fd7dba385f0 Mon Sep 17 00:00:00 2001 From: Aaron O'Leary Date: Wed, 5 Dec 2012 15:15:41 +0000 Subject: [PATCH 1/8] math highlighting --- syntax/mmd.vim | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/syntax/mmd.vim b/syntax/mmd.vim index 1347072..0f6be75 100644 --- a/syntax/mmd.vim +++ b/syntax/mmd.vim @@ -164,6 +164,27 @@ HtmlHiLink mkdLinkAttrib Function HtmlHiLink mkdDelimiter Delimiter +" Maths highlighting (TeX) +" Accepts either multimarkdown bracket notation or $ notation. +" Allows use of literal dollars if they are escaped (\$). If you +" want literal dollars without escaping, you'll have to comment out +" the texinlinemaths line. +syntax include syntax/tex.vim +syn region mmddisplaymaths matchgroup=mkdMath start="\\\\\[" end="\\\\\]" contains=@texMathZoneGroup +syn region texdisplaymaths matchgroup=mkdMath start="\$\$" end="\$\$" skip="\\\$" contains=@texMathZoneGroup +syn region mmdinlinemaths matchgroup=mkdMath start="\\\\(" end="\\\\)" contains=@texMathZoneGroup +" inline maths with $ ... $ +" start is a $ not preceded by another $ - \(\$\)\@ Date: Wed, 5 Feb 2014 14:13:41 -0500 Subject: [PATCH 2/8] Highlight math between \begin{..} and \end{..}. --- syntax/mmd.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/syntax/mmd.vim b/syntax/mmd.vim index 0f6be75..158044f 100644 --- a/syntax/mmd.vim +++ b/syntax/mmd.vim @@ -172,6 +172,7 @@ HtmlHiLink mkdDelimiter Delimiter syntax include syntax/tex.vim syn region mmddisplaymaths matchgroup=mkdMath start="\\\\\[" end="\\\\\]" contains=@texMathZoneGroup syn region texdisplaymaths matchgroup=mkdMath start="\$\$" end="\$\$" skip="\\\$" contains=@texMathZoneGroup +syn region texdisplaymaths matchgroup=mkdMath start='\\begin{\z(.\{-\}\)}' end='\\end{\z1}' contains=@texMathZoneGroup syn region mmdinlinemaths matchgroup=mkdMath start="\\\\(" end="\\\\)" contains=@texMathZoneGroup " inline maths with $ ... $ " start is a $ not preceded by another $ - \(\$\)\@ Date: Wed, 5 Feb 2014 14:42:27 -0500 Subject: [PATCH 3/8] Highlight eqref, and inlinemath. --- syntax/mmd.vim | 51 +++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/syntax/mmd.vim b/syntax/mmd.vim index 158044f..6f133d8 100644 --- a/syntax/mmd.vim +++ b/syntax/mmd.vim @@ -131,12 +131,36 @@ syn region mkdListFold \ end="^\(.\)\@=" \ fold contains=TOP +" Maths highlighting (TeX) +" Accepts either multimarkdown bracket notation or $ notation. +" Allows use of literal dollars if they are escaped (\$). If you +" want literal dollars without escaping, you'll have to comment out +" the texinlinemaths line. +syntax include syntax/tex.vim +syn region mmddisplaymaths matchgroup=mkdMath start="\\\\\[" end="\\\\\]" contains=@texMathZoneGroup +syn region texdisplaymaths matchgroup=mkdMath start="\$\$" end="\$\$" skip="\\\$" contains=@texMathZoneGroup +syn region texdisplaymaths matchgroup=mkdMath start='\\begin{\z(.\{-\}\)}' end='\\end{\z1}' contains=@texMathZoneGroup +syn region mmdinlinemaths matchgroup=mkdMath start="\\\\(" end="\\\\)" contains=@texMathZoneGroup +" inline maths with $ ... $ +" start is a $ not preceded by another $ - \(\$\)\@ Date: Tue, 25 Feb 2014 00:28:25 -0500 Subject: [PATCH 4/8] Don't highlight as code lines that might start lists --- syntax/mmd.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax/mmd.vim b/syntax/mmd.vim index 6f133d8..36e5008 100644 --- a/syntax/mmd.vim +++ b/syntax/mmd.vim @@ -91,7 +91,7 @@ syn match mkdRule /^\s*-\{3,}$/ syn match mkdRule /^\s*\*\{3,5}$/ syn match mkdListItem "^\s*[-*+]\s\+" syn match mkdListItem "^\s*\d\+\.\s\+" -syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ +syn match mkdCode /^\s*\n\%(\%(\s\{4,}\|\t\+\)\%(\%(\*\|[0-9]\+\.\)\s\+\)\@!.*\n\)\+/ syn match mkdLineBreak / \+$/ syn region mkdCode start=/\\\@ Date: Tue, 25 Feb 2014 11:09:00 -0500 Subject: [PATCH 5/8] Only highlight markers in block quotes --- syntax/mmd.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax/mmd.vim b/syntax/mmd.vim index 36e5008..7b9d931 100644 --- a/syntax/mmd.vim +++ b/syntax/mmd.vim @@ -95,7 +95,8 @@ syn match mkdCode /^\s*\n\%(\%(\s\{4,}\|\t\+\)\%(\%(\*\|[0-9]\+\.\)\s\+\)\ syn match mkdLineBreak / \+$/ syn region mkdCode start=/\\\@/ end=/$/ contains=mkdLineBreak,mkdLineContinue,@Spell +"syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLineBreak,mkdLineContinue,@Spell +syn match mkdBlockquote /^\%(\s*>\)\+/ syn region mkdCode start="]*>" end="" syn region mkdCode start="]*>" end="" From 0c16f1a70f3b242b0034500287e27e524cd23dba Mon Sep 17 00:00:00 2001 From: Gautam Iyer Date: Tue, 25 Feb 2014 12:07:14 -0500 Subject: [PATCH 6/8] Transparent folds (fixes Spell highlighting) Also use +, - as list markers in possible code blocks & bugfix. --- syntax/mmd.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/syntax/mmd.vim b/syntax/mmd.vim index 7b9d931..e712de4 100644 --- a/syntax/mmd.vim +++ b/syntax/mmd.vim @@ -91,7 +91,7 @@ syn match mkdRule /^\s*-\{3,}$/ syn match mkdRule /^\s*\*\{3,5}$/ syn match mkdListItem "^\s*[-*+]\s\+" syn match mkdListItem "^\s*\d\+\.\s\+" -syn match mkdCode /^\s*\n\%(\%(\s\{4,}\|\t\+\)\%(\%(\*\|[0-9]\+\.\)\s\+\)\@!.*\n\)\+/ +syn match mkdCode /^\s*\n\%(\%(\s\{4,}\|\t\+\)\%(\%([-*+]\|[0-9]\+\.\)\s\+\)\@!\S.*\n\)\+/ syn match mkdLineBreak / \+$/ syn region mkdCode start=/\\\@" \ end="^" - \ fold contains=TOP + \ fold transparent contains=TOP " fold region for lists syn region mkdListFold \ start="^\z(\s*\)\*\z(\s*\)" \ skip="^\z1 \z2\s*[^#]" \ end="^\(.\)\@=" - \ fold contains=TOP + \ fold transparent contains=TOP " Maths highlighting (TeX) " Accepts either multimarkdown bracket notation or $ notation. From 040ab61dd65ba6f72a72d983439751e09700343a Mon Sep 17 00:00:00 2001 From: Gautam Iyer Date: Tue, 25 Feb 2014 16:51:37 -0500 Subject: [PATCH 7/8] Set comments / tw / fold in the ftplugin file. --- ftplugin/mmd.vim | 20 ++++++++++++++++++++ syntax/mmd.vim | 2 -- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 ftplugin/mmd.vim diff --git a/ftplugin/mmd.vim b/ftplugin/mmd.vim new file mode 100644 index 0000000..5c0250e --- /dev/null +++ b/ftplugin/mmd.vim @@ -0,0 +1,20 @@ +" VIM ftplugin for mail +" Author: Gautam Iyer +" Created: Tue 25 Feb 2014 04:23:18 PM EST +" Modified: Tue 25 Feb 2014 04:50:37 PM EST + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl tw< fo< com<" + +setl ai tw=78 fo+=n2c fdm=syntax + +" Set header markers and list markers as comments. +setl com=fb:######,fb:#####,fb:####,fb:###,fb:##,fb:# "Headers +setl com+=b:> " Block quotes +setl com+=fb:*,fb:-,fb:+ " Lists +" fo+=tcql diff --git a/syntax/mmd.vim b/syntax/mmd.vim index e712de4..b62850f 100644 --- a/syntax/mmd.vim +++ b/syntax/mmd.vim @@ -159,8 +159,6 @@ syn match mkdEqRef '{\zs.\{-\}\ze}' contained syn sync fromstart -setlocal foldmethod=syntax - "highlighting for Markdown groups HtmlHiLink mkdString String From 1b4a689258327c974d644b20e9c61b7743b58486 Mon Sep 17 00:00:00 2001 From: Gautam Iyer Date: Thu, 27 Feb 2014 22:57:46 -0500 Subject: [PATCH 8/8] Set expandtab --- ftplugin/mmd.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ftplugin/mmd.vim b/ftplugin/mmd.vim index 5c0250e..d0ef57f 100644 --- a/ftplugin/mmd.vim +++ b/ftplugin/mmd.vim @@ -1,7 +1,7 @@ " VIM ftplugin for mail " Author: Gautam Iyer " Created: Tue 25 Feb 2014 04:23:18 PM EST -" Modified: Tue 25 Feb 2014 04:50:37 PM EST +" Modified: Wed 26 Feb 2014 03:21:59 PM EST " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -11,7 +11,7 @@ let b:did_ftplugin = 1 let b:undo_ftplugin = "setl tw< fo< com<" -setl ai tw=78 fo+=n2c fdm=syntax +setl ai tw=78 fo+=n2c fdm=syntax et " Set header markers and list markers as comments. setl com=fb:######,fb:#####,fb:####,fb:###,fb:##,fb:# "Headers