Wednesday, February 15, 2017

Re: W-word Boundaries



Den 13 feb 2017 19:52 skrev "Tim Chase" <vim@tim.thechases.com>:
On 2017-02-13 13:34, Shawn H Corey wrote:
>
> The two patterns, \< and \> match w-word boundaries. Is there
> something to match W-word boundaries? The best I came up with is:
>
>     \(^\|\s\)\@<=
>
> I'm writing a syntax file for G+ comments where in-line styles start
> with a W-word boundary, followed by a "*" for bold, "_" for italic,
> and "-" for strikeout. \< and \> only works for italic.
>
> Does anyone know a more elegant way?

Depending on how your final expression is, \S might do the trick, or
you can use a negative lookbehind assertion:

  \S\@<!

So for your markdown words, it could be something like

  \S\@<!\S\+

Or to match just the boundary \S\@<!\S\@= on the 'left' side and \S\@<=\S\@! on the 'right' side. This will work at the start/end of line too 

/bpj

(Doing my best to follow style etiquette in Gmail mobile :-)


--
--
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: