On Wed, Feb 06, 2013 at 07:11:35PM -0800, Gary Johnson wrote:
> On 2013-02-06, Sung Pae wrote:
> > However, I can see now that setting 'iskeyword' in the syntax file
> > instead of the ftplugin is problematic because the setting becomes
> > local to the buffer and not to the filetype, which will cause
> > confusion if a user changes filetypes for a buffer.
> There is no "local to filetype". Filetype plugins make settings that
> are local to the buffer.
> When a user changes filetypes for a buffer, Vim and the filetype
> plugins take care of setting or resetting filetype-dependent
> buffer-local options appropriately.
I should clarify: I meant "local to filetype" in a loose way.
Previously, the syntax file set `setlocal iskeyword+=…` instead of the
ftplugin (where we can add 'setlocal iskeyword<' to b:undo_ftplugin).
Should the user open a new buffer then do:
:setf clojure | setf foo
The buffer will now have loaded foo's filetype settings, but will still
have the additions to 'iskeyword' from Clojure's syntax script since
this setting is buffer-local. This is broken and should be fixed.
Bram, I have attached new patches (cumulative and incremental as before)
with my proposed changes:
* HiLink command is replaced with 'hi def link' and the version
compat check with < 600 is removed.
* 'iskeyword' is moved to ftplugin/clojure.vim
I tried several variations of changing the `syntax keyword` definitions
to `syntax match`, but the performance degrades from 4-10x, depending on
the buffer. Both startup and scrolling are noticeably affected.
If I can convince you that iskeyword+=… is justified for the Clojure
filetype, then I think the syntax groups in question should remain in
`syntax keyword` form in the interest of performance.