On Mi, 12 Sep 2018, Gary Johnson wrote:

> On 2018-09-12, Bram Moolenaar wrote:
> > Gary Johnson wrote:
> > 
> > > When I diff a syntax-highlighted buffer, the diff highlighting often
> > > conflicts with the syntax highlighting so that some text has the
> > > same foreground and background colors and becomes impossible to
> > > read.
> > > 
> > > I have worked around this problem with the following autocommand.
> > > 
> > >     au FilterWritePost * if &diff | setlocal syn=OFF | endif
> > > 
> > > With the new internal diff, this doesn't seem to be working anymore.
> > > That makes sense since the internal diff doesn't need to write any
> > > files, but now we don't seem to have a hook for changing settings
> > > when diff is enabled.
> > > 
> > > What would be nicest is a pair of hooks (autocommand events) that
> > > would be triggered when a buffer entered and left diff mode.
> > > 
> > > Any thoughts on this?
> > 
> > How about using an OptionSet autocommand?  I haven't tried this:
> > 
> >      au OptionSet diff if &diff | setlocal syn=OFF | endif
> 
> In some but not in all cases.  For example, if I run vimdiff as part
> of the "git difftool" command, the OptionSet autocommand is not
> triggered.
> 
> I also tried BufWinEnter, but it didn't help.

That is most likely because OptionSet is not run on startup. However, if 
you add into your .vimrc something like this:

if &diff | setlocal syn= |endif

in addition to the optionset auto command, shouldn't this than work? 
E.g. on startup simply check if the diff option is already set and if 
so, disable syntax highlighting?

Best,
Christian
-- 
Student telegrafiert seinem Vater: Schicke Geld - Dein Sohn
Vater telegrafiert zurück: Habe keins erhalten - Dein Vater

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui