From: Hiroshi Shirosaki Date: Wed, 1 Feb 2017 05:57:39 +0000 (+0900) Subject: Merge pull request #309 from michaelPotter/master X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/72e39306ddbc172932a57b3bee503fc5e487fde0?ds=inline;hp=-c Merge pull request #309 from michaelPotter/master Syntax Concealing for italic/bold/italicbold Items --- 72e39306ddbc172932a57b3bee503fc5e487fde0 diff --combined README.md index f5cbaf9,edd177b..17c97b9 --- a/README.md +++ b/README.md @@@ -81,12 -81,6 +81,12 @@@ let g:vim_markdown_folding_style_python Level 1 heading which is served as a document title is not folded. `g:vim_markdown_folding_level` setting is not active with this fold style. +To prevent foldtext from being set add the following to your `.vimrc`: + +```vim +let g:vim_markdown_override_foldtext = 0 +``` + ### Set header folding level Folding level is a number between 1 and 6. By default, if not specified, it is set to 1. @@@ -134,6 -128,9 +134,9 @@@ let g:vim_markdown_emphasis_multiline Concealing is set for some syntax. For example, conceal `[link text](link url)` as just `link text`. + Also, `_italic_` and `*italic*` will conceal to just _italic_. + Similarly `__bold__`, `**bold**`, `___italic bold___`, and `***italic bold***` + will conceal to just __bold__, **bold**, ___italic bold___, and ***italic bold*** respectively. To enable conceal use Vim's standard conceal configuration. diff --combined doc/vim-markdown.txt index 339fdaf,0d12a1d..3ee30e6 --- a/doc/vim-markdown.txt +++ b/doc/vim-markdown.txt @@@ -96,10 -96,6 +96,10 @@@ To fold in a style like python-mode [6] Level 1 heading which is served as a document title is not folded. 'g:vim_markdown_folding_level' setting is not active with this fold style. +To prevent foldtext from being overridden, add the following to your '.vimrc': + + let g:vim_markdown_override_foldtext = 0 + ------------------------------------------------------------------------------- *vim-markdown-set-header-folding-level* Set header folding level ~ @@@ -150,6 -146,9 +150,9 @@@ Syntax Concealing Concealing is set for some syntax. For example, conceal '[link text](link url)' as just 'link text'. + Also, '_italic_' and '*italic*' will conceal to just 'italic'. + Similarly '__bold__', '**bold**', '___italic bold___', and '***italic bold***' + will conceal to 'bold', 'bold', 'italic bold', and 'italic bold' respectively. To enable conceal use Vim's standard conceal configuration. > diff --combined syntax/markdown.vim index 23a7c4a,35a1d82..5df0430 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@@ -47,12 -47,15 +47,15 @@@ if get(g:, 'vim_markdown_emphasis_multi else let s:oneline = ' oneline' endif - execute 'syn region htmlItalic start="\%(^\|\s\)\zs\*\ze[^\\\*\t ]\%(\%([^*]\|\\\*\|\n\)*[^\\\*\t ]\)\?\*\_W" end="[^\\\*\t ]\zs\*\ze\_W" keepend' . s:oneline - execute 'syn region htmlItalic start="\%(^\|\s\)\zs_\ze[^\\_\t ]" end="[^\\_\t ]\zs_\ze\_W" keepend' . s:oneline - execute 'syn region htmlBold start="\%(^\|\s\)\*\*\ze\S" end="\S\zs\*\*" keepend' . s:oneline - execute 'syn region htmlBold start="\%(^\|\s\)\zs__\ze\S" end="\S\zs__" keepend' . s:oneline - execute 'syn region htmlBoldItalic start="\%(^\|\s\)\zs\*\*\*\ze\S" end="\S\zs\*\*\*" keepend' . s:oneline - execute 'syn region htmlBoldItalic start="\%(^\|\s\)\zs___\ze\S" end="\S\zs___" keepend' . s:oneline + syn region mkdItalic matchgroup=mkdItalic start="\%(\*\|_\)" end="\%(\*\|_\)" + syn region mkdBold matchgroup=mkdBold start="\%(\*\*\|__\)" end="\%(\*\*\|__\)" + syn region mkdBoldItalic matchgroup=mkdBoldItalic start="\%(\*\*\*\|___\)" end="\%(\*\*\*\|___\)" + execute 'syn region htmlItalic matchgroup=mkdItalic start="\%(^\|\s\)\zs\*\ze[^\\\*\t ]\%(\%([^*]\|\\\*\|\n\)*[^\\\*\t ]\)\?\*\_W" end="[^\\\*\t ]\zs\*\ze\_W" keepend' . s:oneline . s:concealends + execute 'syn region htmlItalic matchgroup=mkdItalic start="\%(^\|\s\)\zs_\ze[^\\_\t ]" end="[^\\_\t ]\zs_\ze\_W" keepend' . s:oneline . s:concealends + execute 'syn region htmlBold matchgroup=mkdBold start="\%(^\|\s\)\zs\*\*\ze\S" end="\S\zs\*\*" keepend' . s:oneline . s:concealends + execute 'syn region htmlBold matchgroup=mkdBold start="\%(^\|\s\)\zs__\ze\S" end="\S\zs__" keepend' . s:oneline . s:concealends + execute 'syn region htmlBoldItalic matchgroup=mkdBoldItalic start="\%(^\|\s\)\zs\*\*\*\ze\S" end="\S\zs\*\*\*" keepend' . s:oneline . s:concealends + execute 'syn region htmlBoldItalic matchgroup=mkdBoldItalic start="\%(^\|\s\)\zs___\ze\S" end="\S\zs___" keepend' . s:oneline . s:concealends " [link](URL) | [link][id] | [link][] | ![image](URL) syn region mkdFootnotes matchgroup=mkdDelimiter start="\[^" end="\]" @@@ -102,7 -105,7 +105,7 @@@ syn region mkdFootnote start="\[^ 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 match mkdListItem /^\s*\%([-*+]\|\d\+\.\)\s\+/ contained +syn match mkdListItem /^\s*\%([-*+]\|\d\+\.\)\ze\s\+/ contained syn region mkdListItemLine start="^\s*\%([-*+]\|\d\+\.\)\s\+" end="$" oneline contains=@mkdNonListItem,mkdListItem,@Spell syn region mkdNonListItemBlock start="\(\%^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@!\|\n\(\_^\_$\|\s\{4,}[^ ]\|\t+[^\t]\)\@!\)" end="^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@=" contains=@mkdNonListItem,@Spell syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*$/