On 17/06/08 16:40, Yakov Lerner wrote:
> We do not have autocommand that fires when option is set/changed, right ?
> vim 8 maybe ? Can this be added to do todo ?
>
> For example, when I do 'set tw=70' I want automatically
> execute "match Error /\%>70v/".
>
> I realize I can make a custom command or function to
> change two things together. But if this was a good method, then vim
> never had autocommands in the first place.
>
> Yakov

You can define an autocommand on some other event(s) (CursorMoved and 
CursorMovedI, maybe) to highlight whatever gets after the 'textwidth'. 
Here's an example:

        :au CursorMoved  * exe 'match Error /\%>' . &tw . 'v/'
        :au CursorMovedI * exe 'match Error /\%>' . &tw . 'v/'

These events are already used by the matchparen.vim plugin, so you're in 
good company.

Best regards,
Tony.
-- 
Somewhere, just out of sight, the unicorns are gathering.

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

Raspunde prin e-mail lui