From: Jens Hoepken Date: Tue, 19 Mar 2013 12:58:38 +0000 (+0100) Subject: Resolve merge conflict X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/26cfc8ef05385a8b5f526c4d461d982a82b119b2?hp=a87c86a61b583e803e8c0237ed569fa4b3119e20 Resolve merge conflict --- diff --git a/README.md b/README.md new file mode 100644 index 0000000..a11299b --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# Markdown Vim Mode + +Syntax highlighting and matching rules for [Markdown](http://daringfireball.net/projects/markdown/). + +## Installation + +If you use [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332)(and you should), do this: + + $ cd ~/.vim/bundle + $ git clone https://github.com/plasticboy/vim-markdown.git + +To install without Pathogen, download the [tarball](https://github.com/plasticboy/vim-markdown/archive/master.tar.gz) and do this: + + $ cd ~/.vim + $ tar --strip=1 -zxf vim-markdown-master.tar.gz + +[Homepage](http://plasticboy.com/markdown-vim-mode/) + +## License + +The MIT License (MIT) + +Copyright (c) 2012 Benjamin D. Williams + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/after/ftplugin/mkd.vim b/after/ftplugin/mkd.vim new file mode 100644 index 0000000..b0b0946 --- /dev/null +++ b/after/ftplugin/mkd.vim @@ -0,0 +1,48 @@ +" folding for Markdown headers, both styles (atx- and setex-) +" http://daringfireball.net/projects/markdown/syntax#header +" +" this code can be placed in file +" $HOME/.vim/after/ftplugin/markdown.vim +" +" original version from Steve Losh's gist: https://gist.github.com/1038710 + +func! Foldexpr_markdown(lnum) + if (a:lnum == 1) + let l0 = '' + else + let l0 = getline(a:lnum-1) + endif + + let l1 = getline(a:lnum) + + let l2 = getline(a:lnum+1) + + if l2 =~ '^==\+\s*' + " next line is underlined (level 1) + return '>1' + elseif l2 =~ '^--\+\s*' + " next line is underlined (level 2) + return '>2' + elseif l1 =~ '^#' + " don't include the section title in the fold + return '-1' + elseif l0 =~ '^#' + " current line starts with hashes + return '>'.matchend(l0, '^#\+') + else + " keep previous foldlevel + return '=' + endif +endfunc + +setlocal foldexpr=Foldexpr_markdown(v:lnum) +setlocal foldmethod=expr + +"---------- everything after this is optional ----------------------- +" change the following fold options to your liking +" see ':help fold-options' for more +setlocal foldenable +setlocal foldlevel=0 +setlocal foldcolumn=0 +set foldmethod=expr +set foldopen-=search diff --git a/ftdetect/mkd.vim b/ftdetect/mkd.vim index ab36f5c..9696cac 100644 --- a/ftdetect/mkd.vim +++ b/ftdetect/mkd.vim @@ -1,3 +1,3 @@ " markdown filetype file au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=mkd - +au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn}.{des3,des,bf,bfa,aes,idea,cast,rc2,rc4,rc5,desx} set filetype=mkd diff --git a/syntax/mkd.vim b/syntax/mkd.vim index eda1acf..20b1d3a 100644 --- a/syntax/mkd.vim +++ b/syntax/mkd.vim @@ -36,15 +36,18 @@ syn case ignore syn sync linebreaks=1 "additions to HTML groups -syn region htmlBold start=/\\\@/ end=/$/ contains=mkdLineBreak,mkdLineContinue,@Spell -syn region mkdCode start="]*>" end="" -syn region mkdCode start="]*>" end="" +syn match mkdLineBreak / \+$/ +syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLineBreak,mkdLineContinue,@Spell +syn region mkdCode start=/\(\([^\\]\|^\)\\\)\@]*>" end="" +syn region mkdCode start="]*>" end="" +syn region mkdFootnote start="\[^" end="\]" +syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ +syn match mkdListItem "^\s*[-*+]\s\+" +syn match mkdListItem "^\s*\d\+\.\s\+" +syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*$/ +syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-$/ +syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_$/ +syn match mkdRule /^\s*-\{3,}$/ +syn match mkdRule /^\s*\*\{3,5}$/ "HTML headings syn region htmlH1 start="^\s*#" end="\($\|#\+\)" contains=@Spell @@ -85,27 +89,6 @@ syn region htmlH6 start="^\s*######" end="\($\|#\+\)" contain syn match htmlH1 /^.\+\n=\+$/ contains=@Spell syn match htmlH2 /^.\+\n-\+$/ contains=@Spell - - -" fold region for headings -syn region mkdHeaderFold - \ start="^\s*\z(#\+\)" - \ skip="^\s*\z1#\+" - \ end="^\(\s*#\)\@=" - \ fold contains=TOP - -" fold region for lists -syn region mkdListFold - \ start="^\z(\s*\)\*\z(\s*\)" - \ skip="^\z1 \z2\s*[^#]" - \ end="^\(.\)\@=" - \ fold contains=TOP - -syn sync fromstart -setlocal foldmethod=syntax - - - "highlighting for Markdown groups HtmlHiLink mkdString String HtmlHiLink mkdCode String @@ -115,6 +98,7 @@ HtmlHiLink mkdLineContinue Comment HtmlHiLink mkdListItem Identifier HtmlHiLink mkdRule Identifier HtmlHiLink mkdLineBreak Todo +HtmlHiLink mkdFootnotes htmlLink HtmlHiLink mkdLink htmlLink HtmlHiLink mkdURL htmlString HtmlHiLink mkdInlineURL htmlLink