Waters, Bill schrieb:
> I see discussions related to this, but not exactly what I am looking
> for.
>
> I have a file that is made up of mostly a specific pattern. I want to
> highlight all of the text that is NOT that specific pattern.
>
> I see how to highlight the lines that don't contain the pattern...
>
> /^\(\(pattern\)\...@!.\)*$
>
> ...but I want to do it at the character level.
>
> Thanks, Bill
Your "inverse pattern" needs to prevent a match at any single position
occupied by a match of the original pattern.
I tried with some examples:
A literal pattern:
/setf
->
/\%(setf\|s\@<=etf\|\%(se\)\@<=tf\|\%(set\)\@<=f\)\...@!.
Pattern with .* that for example matches "highlightin":
/hi.*in
->
/\%(hi.*in\|h\@<=i.*in\|\%(hi.*\)\@<=.*in\|\%(hi.*i\)\@<=n\)\...@!.
Pattern with or-branch:
/any\|match
->
/\%(any\|match\|a\@<=ny\|m\@<=atch\|\%(an\)\@<=y\|\%(ma\)\@<=tch\|\%(mat\)\@<=ch\|\%(matc\)\@<=h\)\...@!.
/\v%(any|match|a@<=ny|m@<=atch|%(an)@<=y|%(ma)@<=tch|%(mat)@<=ch|%(matc)@<=h)@!.
etc.
... very impractical. I'm not even sure if you can do it in general.
Just for highlighting, I'd do
:match Ignore /{pattern}/
--
Andy
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---