Package: vim-nox Version: 2:8.1.2269-1 Severity: normal Tags: upstream Dear Maintainer,
* What led up to the situation? I wanted to write a custom syntax file that includes another syntax file. (Specifically, I wanted to write a syntax filefor zsh's test suite, and have it include the zsh syntax file shipped with Vim itself. zsh's test suite consists of test cases, that should be highlighted as zsh scripts, plus metadata such as the expected exit code, which would be highlighted by the custom syntax file I was writing.) * What exactly did you do (or not do) that was effective (or ineffective)? To cut a long story short, here's a minimal example: % head -999 .vim/syntax/foo.vim .vim/syntax/bar.vim iota ==> .vim/syntax/foo.vim <== if exists("b:current_syntax") finish endif syntax clear syntax include @bar <sfile>:p:h/bar.vim unlet b:current_syntax syntax region fooBlock start=/^\s/ end=/$/ contains=@bar let b:current_syntax = "foo" ==> .vim/syntax/bar.vim <== if exists("b:current_syntax") finish endif syntax clear syntax region barBlock matchgroup=barBraces start=+{+ end=+}+ transparent contains=TOP syntax keyword barKeyword lorem ipsum hi def link barBraces Special hi def link barKeyword Keyword let b:current_syntax = "bar" ==> iota <== { lorem ipsum dolor sit amet } lorem ipsum dolor sit amet % (For orientation, in this example foo.vim stands for my custom syntax, bar.vim stands for $VIMRUNTIME/syntax/zsh.vim, barBlock corresponds to zshBrackets, and barKeyword corresponds to the zsh.vim syntax rules responsible for highlighting, say, the «cd» and «$0» in «{ cd $0 }».) * What was the outcome of this action? When the file iota is viewed with «set filetype=foo», the words "lorem ipsum" on line 1 are not highlighted. * What outcome did you expect instead? I expected those two words on line 1 to be highlighted (via the chain TOP -> fooBlock -> @bar -> barBlock -> barKeyword). I note that if contains=TOP is either removed, or changed to contains=@bar, then the words on line 1 do get highlighted. However, either of these changes would break the highlighting of ft=bar files. It seems to me that when «contains=TOP» is encountered in a :syn-include'd file, it's taken as a reference to the actual top-level, i.e., the top of foo.vim, rather than as a reference to the top of the included syntax's scope, i.e., the syntax match or region that did «contains=@bar». Cheers, Daniel -- Package-specific info: (Freshly-created, up-to-date sid chroot with default settings.)