Wednesday, November 13, 2013

Re: Question about markdown-syntax-recognition

Niels Kobschaetzki <niels@kobschaetzki.net> a écrit:
> On Wed, Nov 13, 2013 at 12:32:08PM +0100, Paul Isambert wrote:
> >De: "Niels Kobschätzki" <niels@kobschaetzki.net>
> >> I am taking notes with markdown-syntax and often use nested unorderd
> >> lists. For example:
> >> - Test1
> >> - Test2
> >> - Test3
> >> - Test4
> >>
> >> With the first three lines the "-" gets colored correctly as an
> >> unordered list marker. But starting from Test4, so the third
> >> indentation
> >> the "-" doesn't get highlighted anymore. What can I do to change
> >> this?
> >> I took a look into the syntax file of markdown and I guess
> >> syn match markdownListMarker "\%(\t\| \{0,4\}\)[-*+]\%(\s\+\S\)\@="
> >> contained
> >> is the line that is responsible for it but I have no idea what I need
> >> to
> >> change to add a few indentations. I tried changing the 4 to a 5 but
> >> that
> >> didn't help.
> >> So, what do I have to do?
> >
> >Change 4 to 6 :)
> >
> >Actually you could even do
> >
> > syn match markdownListMarker "\%(\t\| *\)[-*+]\%(\s\+\S\)\@="
> >
> >I don't know why it is originally limited to 4 spaces (or exactly one tab);
> >this way any number of spaces is ok.
>
> Thanks a lot. That solved my problem :D

And I forgot (was reminded by a recent misunderstanding on this very
list), you should either

- write to the author of the syntax file so he changes it (in case
there was no good reason to put a limit on the number of spaces, but
that is quite unlikely);
- or write a markdown.vim syntax file yourself with something like:

source $VIMRUNTIME/syntax/markdown.vim
syn match markdownListMarker "\%(\t\| *\)[-*+]\%(\s\+\S\)\@="

In other words, don't modify the original markdown.vim itself,
otherwise your change will be deleted on updates.

Best,
Paul

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: