vim icon indicating copy to clipboard operation
vim copied to clipboard

syn-iskeyword should not be global

Open agvxov opened this issue 1 year ago • 2 comments
trafficstars

The command :sy[ntax] iskeyword [clear | {option}] effects all keywords. What this means is that syntax scripts which utilize this feature (e.g. default runtime CSS) bleed behavior into any other syntax script including them. In practice this can break the highlighting of some keywords if they are followed by what otherwise would be non-keyword symbols.

Possible solutions:

  • make it behave similar to :sy[ntax] case [match | ignore] where it only affects the keyword definitions following it so it can be safely cleared after the relevant keywords
  • do not use it in default syntax scripts (modifying such keywords to matches instead) (this would mean 35 instances)

For the second solution I could submit a PR myself if its agreed on; for the first, I'm afraid I don't know Vim's internals enough.

Vim version:

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled May  9 2024 01:11:14)
Included patches: 1-366

agvxov avatar Jul 03 '24 15:07 agvxov

That is not so simple, because syn keyword modifies the global state of what characters are considered keyword characters. The second alternative, while possible will have impacts on priorities and speed unfortunately.

chrisbra avatar Jul 03 '24 16:07 chrisbra

I see, I understand. Should I close this as "Not Planned" or leave it up indefinitely?

agvxov avatar Jul 23 '24 18:07 agvxov