Vim NerdCommenter:在vimrc中添加新文件类型 [英] Vim NerdCommenter: adding a new filetype in vimrc
问题描述
是否可以在.vimrc中为NerdCommenter定义新的文件类型注释?
is there a way to define a new filetype comment for NerdCommenter in .vimrc?
它已经在工作,但是如果我可以直接将其放入.vimrc,则备份配置会更容易.
It's already working, but it would be more easy to backup config, if I can place this into .vimrc directly.
谢谢.
推荐答案
NERDCommenter能够解析commentstring
选项,因此,如果只有一个可能的注释标记,则可以将以下内容添加到vimrc中:
NERDCommenter is able to parse commentstring
option, so if you have only one possible comment marker, you may put the following to the vimrc:
augroup SetCMS
autocmd FileType ocaml let &l:commentstring='(*%s*)'
augroup END
这不允许您指定其他注释样式(例如C ++的/*%s*/
和//%s
).在这种情况下,您应该联系NERDCommenter的作者,他将把您的文件类型添加到下一个版本中. 这是文件类型支持请求的示例.
This does not allow you to specify alternative commenting style (like /*%s*/
and //%s
for C++). In this case you should contact author of NERDCommenter and he will add your filetype into next release. This is the example of filetype support request.
这篇关于Vim NerdCommenter:在vimrc中添加新文件类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!