What about using the already existing commands below (assuming Vim
version 6.2 or later)?

let s:save_isk = &l:isk
try
  setl isk&vim        " or to whatever value is desired
  …
  …
  …
finally
  let &l:isk = s:save_isk
endtry

IMHO authors who won't bother saving and restoring the option won't
use your new command either, especially since it will have to be
bracketed by if exists() in all third-party syntax scripts, to guard
against the possibility of running on a Vim compiled without the
patch.


Best regards,
Tony.

On Tue, Oct 27, 2015 at 12:44 PM, Christian Brabandt <[email protected]> wrote:
> 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?
>
> 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