On 2024-06-17, Andreas Otto <
aotto1...@gmail.com> wrote:
> Hi is it possible to change the syntax for a limit part of a file?
Yes. See :help syn-include and :help mysyntaxfile-add.
> example: tcl file with bash syntax used with "pseudo code" vim: push … vim:
I do not recommend using comments with `vim:` because they are
interpreted specially by Vim. Just use (for instance):
if {checkNotIgnore("DIFF")} {
File_Exec_BASH {
# syntax=bash
[...]
# pop syntax
} <@stdin >@stdout 2>@stderr
}
Create ~/.vim/after/syntax/tcl.vim with this content:
unlet b:current_syntax
syn include @Bash syntax/bash.vim
syn region tclBash matchgroup=Comment start=/^\s*# syntax=bash/ end=/^\s*# pop syntax/ contains=@Bash
let b:current_syntax = "tcl"
Hope this helps,
Life.