Javascript 修改coffee.vim中的注释突出显示时出现问题
我正在尝试修改CoffeeScript评论的亮点:Javascript 修改coffee.vim中的注释突出显示时出现问题,javascript,vim,coffeescript,Javascript,Vim,Coffeescript,我正在尝试修改CoffeeScript评论的亮点: "" coffeescript comments syntax keyword coffeescriptCommentTodo TODO FIXME XXX TBD contained syntax region coffeescriptLineComment start=/####\@!/ end=/###/ keepend contains=coffeescriptCommentTodo,@Spell syntax regio
"" coffeescript comments
syntax keyword coffeescriptCommentTodo TODO FIXME XXX TBD contained
syntax region coffeescriptLineComment start=/####\@!/ end=/###/ keepend contains=coffeescriptCommentTodo,@Spell
syntax region coffeescriptEnvComment start=/####\@!/ end=/###/ display
syntax region coffeescriptLineComment start=/####\@!/ end=/###/ keepend contains=coffeescriptCommentTodo,@Spell fold
syntax region coffeescriptCvsTag start="\$\cid:" end="\$" oneline contained
syntax region coffeescriptComment start=/#*/ end="\$" contains=coffeescriptCommentTodo,coffeescriptCvsTag,@Spell fold
我承认我做这件事有点随意,基于我自己的另一个语法文件:
syn match coffeeComment /#.*/ contains=@Spell,coffeeTodo
hi def link coffeeComment Comment
syn region coffeeBlockComment start=/####\@!/ end=/###/
\ contains=@Spell,coffeeTodo
hi def link coffeeBlockComment coffeeComment
" A comment in a heregex
syn region coffeeHeregexComment start=/#/ end=/\ze\/\/\/\|$/ contained
\ contains=@Spell,coffeeTodo
hi def link coffeeHeregexComment coffeeComment
现在我有了(第一个代码),除了if语句之外,所有的语句看起来都被注释了。如何修改语法文件以正确突出显示CoffeeScript注释
搜索*
会匹配任何文件的全部,因为*
会匹配前面字符的任何数字,甚至是零。所以所有字符都匹配零#
s
这就是为什么您发布的示例使用.*
——匹配一个.
,然后匹配任意数量的字符(.*
)
我发现这是一个有用的参考:
令人不快的是:
syntax region coffeescriptComment start=/#*/ end="\$" contains=coffeescriptCommentTodo,coffeescriptCvsTag,@Spell fold
请尝试:start=/\+/
至少匹配一个
或更多