Hi Bram!
On Sa, 02 Apr 2016, Bram Moolenaar wrote:
>
> James McCoy wrote:
>
> > > > There seems to be a snippet that's been cargo-culted into colorschemes,
> > > > but I can't find justification for.
> > > >
> > > > if exists('syntax_on')
> > > > syntax reset
> > > > endif
> > > >
> > > > Given that syntax items just link to highlight groups and it's the
> > > > highlight groups which define the colors, why should a colorscheme be
> > > > calling ":syntax reset"?
> > > >
> > > > The reason I noticed this is that there's actually a noticeable impact
> > > > of resetting the syntax now. If there was before, I never encountered
> > > > it.
> > > >
> > > > If a syntax file is using ":syn iskeyword", then this is cleared when a
> > > > user changes their colorscheme, breaking the highlighting that was in
> > > > effect. This can trivially be seen with the sh syntax.
> > > >
> > > > --8<--
> > > > #!/bin/sh
> > > > apply_patch make-some-case-work
> > > >
> > > > if true; then
> > > > echo Something
> > > > fi
> > > > -->8--
> > > >
> > > > Given the above foo.sh, everything looks appropriately highlighted when
> > > > initially opened. Set the colorscheme again (even just back to what it
> > > > is -- :exe 'color '.g:colors_name) and now the fi is highlighted as an
> > > > error while most of the rest has lost its highlighting.
> > > >
> > > > So, is this just a relic of the original implementation or is there
> > > > an actual reason that this snippet needs to be put into colorschemes?
> > > > If it's legitimate, shouldn't it be done by Vim instead of cargo-culted
> > > > into every colorscheme?
> > >
> > > The command is a bit of a misnomer, it actually only affects
> > > highlighting.
> >
> > Clearly that's not all it does since “syn iskeyword” is changed by “syn
> > reset”. If it's only *intended* to reset the highlighting, then it
> > should be fixed to not also reset “syn iskeyword”.
>
> Ah, that looks like a bug introduced by patch 7.4.1142. The author also
> was confused by the semantics of this command.
Indeed. I remember stumbling over this and in the end I thought, from
the command name it should be clear that reset also clears the iskword
setting. I did not think about colorschemes resetting it. Thanks for
fixing this.
Best,
Christian
--
Man wird alt, wenn die Leute anfangen zu sagen, daß man jung aussieht.
-- Karl Dall
--
--
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.