Tuesday, November 12, 2019

Re: Highlighting parenthesized blocks

Thanks… but no thanks… :( I remember spending some time disabling / rid getting of that plugin that had all my parentheses jumping around like Mexican frijoles at one point… and sorry if I was unclear… I do not want to highlight the opening and ending inline footnotes markers. What I need is to highlight the entire footnote text so such footnotes are easy to spot at a glance in lengthy markdown files.

This should be taken care of by the markdown.vim syntax file but it does not work on my debian system either with my personal colorscheme or with the 'default' colorscheme that ships with vim 8.1.

So instead of opening an issue with the author of the syntax file (one Tim Pope as per the comments in the file) I thought it would be in my best interest to find a workaround that does the job now when I need it rather than wait for weeks… months… years… for a hypothetical fix… when I will have moved on to other things and completely forgotten my markdown footnotes headaches. Fixing or should I say 'fixing'… the syntax file is not even something straightforward that I want to look into since it may very well turn out that the particular flavour of markdown that I use among many others (pandoc markdown) may not follow the syntax the general markdown rules that the markdown.vim files was written for in the first place.

That's why I started looking at a way to do the highlighting manually via a ':set hls'+'some regex…' that would match '^[' followed by any non ']' sequence of characters including newlines until it reached the ending square bracket. I quickly found one that more or less works when the footnote spans only two lines and its text does not contain closing square brackets… (/\^[.*\n.*\]) or something…) but I was unable to find a way to extend this logic to match footnotes that span more than 2 lines. Basically I would need to repeat the 'sequence of non-] characters ending with a new line' bit any number of times until it reached the final ']'. Not even sure that this is something that regular expressions are supposed to be able to do for that matter.

I have a feeling my only option it to try writing a modified version of the standard markdown.vim file mimicking the way such blocks are handled by html.vim for stuff like italicised and bold text?

Any other suggestions?

Thanks,

CJ   

On Monday, November 11, 2019 at 7:20:16 PM UTC-5, Chris Jones wrote:
I would need to highlight blocks of text delimited by opening/closing parentheses of any given type (regular, square, curly, squiggly, etc.).

For instance:

'… this is some text (here is a parenthesized block) that I would like to stand out.'

then a few lines down:

'… more text an here again (I have another parenthesized block) that I also want highlighted.

This one is simple enough… after I ':set hls' and search via '/(.*)' the parenthesized text is matched by the regex and highlighted as specified by the color scheme.

It gets a little less obvious when some of the parenthesized blocks may span more than a single lines.

Is there any way this can be done via vim regular expressions?

N.B. I know about the matching paren thingy but that is not what I want — I want the whole 'opening paren+text+closing paren' to stand out.

The context is that I have some rather large markdown files to inspect with numerous inline footnotes whose syntax is:

'^[ footnote ]'

and I am looking for a reliable way to make such footnotes stand out so I can (1) spot them at a glance and (2) easily check that they are syntaxically AOK.

To keep it simple I am not concerned about the possiblity of having square bracketed text within the footnotes.

Thanks,

CJ

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/727ef75c-d760-421a-8ff3-3c401a92d9fb%40googlegroups.com.

No comments: