> L~4dPd ·dSdf0D wrote:
>> Hi, I'm a programmer and I alwas type code with: */_syntax off _/*due
>> I have headache if the Color syntax is set "On".
>> Is there any way to set color only in the current line.
>>
>> One more thing: ¿how to disable de color in the  " ~ "character.
>> Thanks. Hans
> I tried using "Normal" but that doesn't seem to cause the desired
> override.  So, you're likely to want to change the "Nrml" highlighting
> colors to whatever you want.  I've set them here to green on black.
>
> hi        Nrml        ctermfg=green ctermbg=black guifg=green guibg=black
> match    Nrml    /^\%(\%(\%#\)\...@!.\)*$/

You probably want to wrap the match command into an CursorMoved or
CursorMovedI autocommand, since :h \%# states that:

,----
| WARNING: When the cursor is moved after the pattern was used, the
| result becomes invalid.  Vim doesn't automatically update the matches.
| This is especially relevant for syntax highlighting and 'hlsearch'.
| In other words: When the cursor moves the display isn't updated for
| this change.  An update is done for lines which are changed (the whole
| line is updated) or when using the |CTRL-L| command (the whole screen
| is updated).  Example, to highlight the word under the cursor: >
`----

So if you are not constantly changing text, but also want the
highlighting to apply when moving in the buffer, you either want to
redraw the screen when the cursor was moved or adjust the match. To
redraw the screen use this autocommand:

:au CursorMoved,CursorMovedI * redraw!

or adjust the match:

au CursorMoved,CursorMovedI * match    Nrml    /^\%(\%(\%#\)\...@!.\)*$/

Either one of these autocommands should do the trick, but I personally
found the second one better, since I noticed the redrawing every once in
a while.

regards,
Christian


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to