tried both with [^0] and 0. If one doesn't match the other one should
but I don't see anything highlighted in red.
Running :hi I can see that ErrorMsg is white text on a red background
so it should show up. What am I missing?
...Stephen
On Wed, Sep 15, 2010 at 06:01, C K Kashyap <ckkashyap@gmail.com> wrote:
> Perhaps matchadd can help - the original poster seems to want to
> highlight multiple items at once
>
> :call matchadd('ErrorMsg','\_^\%([^\t]*\t\)\{4}\zs[^0]')
>
> The above line marks every 4th col that's NOT 0 in error color - red
> You can run the above command for all the columns where you want this
> to be applied.
>
> On Wed, Sep 15, 2010 at 6:10 AM, Tim Chase <vim@tim.thechases.com> wrote:
>> On 09/14/10 17:36, Stephen Rasku wrote:
>>>
>>> Is there a way in vim to search for text in specific columns? I want
>>> to find all instances where every 8th column (i.e 8, 16, 32, etc.) is
>>> not '0'. Is this possible?
>>
>> Short answer: yes.
>>
>> Longer answer: the "how" depends on whether they're delimited columns (such
>> as a comma-delimited or tab-delimited file) or if they're just raw
>> character-count-from-beginning-of-line. The latter is the simple case,
>> where you can use the \%8c atom (there's a similar \%v for virtual columns,
>> which take tabs into consideration)
>>
>> :help /\%c
>> :help /\%v
>>
>> So you can do your search something like
>>
>> /\%8c0
>>
>> (I might have a fenceposting error there, but you can adjust the "8" for
>> whichever column you want)
>>
>>
>> For the more complex case of a simple tab/comma delimited file (not with
>> quotable delimiters), you can do something like
>>
>> /^\%([^\t]*\t\)\{7}0\t " tab delim
>> /^\%([^,]*,\)\{7}0, " comma delim
>>
>> For quotable-delimiters such as
>>
>> col1,"col2,col2,col2",col3, ...
>>
>> it's a bit more complex. Doable, but more complex (if this is your case,
>> let me know and I'll expound).
>>
>> -tim
>>
>>
>>
>>
>>
>>
>> --
>> 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
>>
>
>
>
> --
> Regards,
> Kashyap
>
--
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
No comments:
Post a Comment