2015-10-27 14:44 GMT+03:00 Christian Brabandt <[email protected]>:
> Hi,
> currently setting 'isk' option has - among others - an unwanted side
> effect on the syntax highlighting.
>
> For example by removing the '_' from the 'iskeyword' setting, defined
> syntax keywords start matching where they didn't match before.
>
> E.g. in a SQL buffer,
>
> CREATE TABLE FOOBAR(
>      CRTD_BY     VARCHAR2(100));
>
> Setting :setlocal isk-=_ will make the 'BY' highlighted as syntax
> keyword. I believe this is unwanted and therefore I propose the
> following enhancement:
>
> Add a new syntax command ":syn option iskeyword" for specifically
> setting the 'iskeyword' setting to sane values. So in a syntax file, one
> could set: >
>     :syn option iskeyword @,48-57,_,192-255
> <
> and have syntax highlighting make work as expected independent on the
> users choice of setting the 'isk' setting. If this is not done, syntax
> highlighting will depend on the users 'isk' setting as before.
>
> The current syntax iskeyword setting can be seen by using: >
>      :syn option iskeyword
> <
>
> And it can be reset to the old behaviour using: >
>      :syn option iskeyword clear
> <
>
> I did add the syn-option command, so that later on, it can be extended
> to other options as well, if this should be necessary.
>
> Attached is a proof of concept patch, that does this.
>
> Any comments?

Somewhere in the Neovim bug tracker I suggested that it would be
better to do another thing:

When syntax file is being loaded
save user &iskeyword setting then
at the each :syn statement save :syn-statement-specific &iskeyword
setting, attached to :syn statement.
After syntax file was loaded restore user &iskeyword setting.

>From your description this is going to work like if all syntax authors
replaced :setl isk with :syn option iskeyword. But note the
differences:

1. No need to change existing syntax files.
2. &iskeyword setting is attached to *:syn statement*, not buffer or
window structure. Note that user &iskeyword setting is not the only
cause for highlighting breakage: there is also :syn include and files
included this way may have different &iskeyword setting (:syn include
should also save/restore &iskeyword thus).

This will, of course, either raise memory footprint very much or
require managing &iskeyword tables separately of syntax definitions.

Note that my approach is not fixing syntax highlighting affected by
user &iskeyword setting. My approach is fixing syntax files, messing
with my &iskeyword setting. :syn option iskeyword is not going to
solve this because it is not currently used. And with policies
“runtime file updates can only be sent by file maintainers” (like if
they can’t pull in the changes) and “other people commits are too ? to
merge them into the master” with “squash the world before updating
runtime files” (so that it is harder to maintain a parrallel branch,
and there are no explanations “why was this change made” in commit
messages and “who made this change” in other metadata) this is not
going to happen ever.

>
> Best,
> Christian
> --
> Letzte Worte eines Fahrlehrers:
>   "Nun versuchen Sie's alleine."
>
> --
> --
> 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.

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