Tuesday, June 28, 2016

Re: horizontal range, kindof

Mind the reply to!
Den 27 jun 2016 17:53 skrev "Tumbler Terrall" <kingdombound13@gmail.com>:
>
> On Monday, June 27, 2016 at 6:12:47 AM UTC-5, BPJ wrote:
> > I'm trying to do a substitution in a 'horizontal/virtual column range'.
> >
> > I have an ASCII table where the columns are separated by tab
> > characters (for now). I want to wrap the contents (which contain
> > space (U+0020) and \S characters, being of unequal length of
> > course!) of some specific table columns in asterisks (think
> > Markdown emphasis). I thought I could use a range and \%v to
> > match the text between two screen virtual columns and then use an
> > expression with substitute() to wrap instances of \T\+
> > inside the matched screen column range, something like
> >
> >     'a,'b s/\%13v.*\%46v/\=substitute(submatch(0),'\T\+','*&*','g')/
> >
> > but apparently I've misunderstood \%v because I get no match.
> > So what is the right way to do this? I'm not looking forward to
> > changing three columns on some 70 lines manually!
> >
> > /bpj
>
> What are you trying to match with "\T"? Because as far as I can tell that
> matches the letter "t". If you're looking to match tabs, that would be "\t".
> The case does make a difference.

It was intended to  match anything but a tab, but I see now that that escape isn't supported by Vim. Anyway I ended up writing an external filter in Perl, since the needed steps turned out to be somewhat more complicated than I first thought: I needed to leave some Pandoc footnote marks outside the emphasis.

--
--
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/d/optout.

No comments:

Post a Comment