Wednesday, February 3, 2016

Re: Puzzling behavior of AnsiEsc! in an autocommand

On 2016-02-03, Charles E Campbell wrote:
> Gary Johnson wrote:
> > I'm running Vim 7.4.1152 in an xterm on a Red Hat Enterprise Linux
> > 7.1 system and using Dr. Chip's AnsiEsc plugin (v13i) to make ANSI
> > color escape sequences in some files readable.
> >
> > I noticed some odd behavior and simplified the conditions down to
> > this (one line).
> >
> > $ vim -N -u NONE -o2 --cmd 'so plugin/cecutil.vim' --cmd 'so plugin/AnsiEscPlugin.vim' --cmd 'au BufWinEnter * AnsiEsc' --cmd 'au ColorScheme * AnsiEsc!'
> >
> > I used "-o2" to make the current-window and not-current-window
> > status lines visible. <snip>
> Hello:
>
> AnsiEsc! is intended to
>
> * clear out AnsiEsc syntax (syn clear)
> * clear out AnsiEsc highlighting (hi clear)
> * restore normal syntax highlighting (syn reset)
>
> It appears that the "hi clear" step inside a ColorScheme autocmd is
> evoking the odd highlighting change; I tried putting "hi clear" in the
> place of "ansiesc!" and that did not cause the odd effect. commenting
> out the one line (hi clear) in the ansiesc.vim script avoids the odd
> highlighting change.
>
> looks to me like an odd vim thing.

Thanks for looking into this. With your results as a guide, I
reduced the environment needed to reproduce the issue even further.
Now the vim command is simply this,

$ vim -N -u NONE -o2 --cmd 'so colorschemetest.vim' --cmd 'au ColorScheme * call CSTest()'

where colorschemetest.vim contains this function:

fun CSTest()
hi clear
endfun

Executing ":colorscheme default" causes all highlighting to be
cleared, not restored to the defaults.

The issue seems to occur only when ":hi clear" is contained in a
function _and_ that function is called from a ColorScheme
autocommand.

Regards,
Gary

--
--
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

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

No comments: