RPN wrote:
>
> On Mar 10, 4:13 am, Christian Brabandt <[email protected]> wrote:
>
>   
>> Combine this with a CursorMoved autocmd testing for modification of
>> the buffer (e.g.
>> au CursorMoved * if (&modified) | syn off | else |syn on
>>     
>
> I tried putting this in my vimrc. It does work in a limited way but
> has a bizarre side effect.
>
> Symptoms:
>
> syn is on when I open file.
> If I dd syn  turns off. [good]
>
> BUT as soon as I open the file my cursor keys are unresponsive. They
> stay unresponsive till I do a dd. Then the syn highlighting disappears
> and my cursory keys start working again.
>
> Any clues?
>
>   
Try the following:

au InsertEnter * if exists("syntax_on")| syn off | endif
au InsertLeave * syn on
au CursorMoved * if &modified && exists("syntax_on") | syn off | endif
au BufWritePost * if !exists("syntax_on") | syn on | endif
 
As you can see, I added one event -- if you've written the buffer, 
presumably its safe to syntax highlight.

Regards,
Chip Campbell


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

Reply via email to