Reputation: 2189
is there a way to define a new filetype comment for NerdCommenter in .vimrc?
It's already working, but it would be more easy to backup config, if I can place this into .vimrc directly.
Thanks.
Upvotes: 4
Views: 1337
Reputation: 524
The recommended approach from the NERDCommenter help documentation seems to actually be to add the following to your .vimrc:
let g:NERDCustomDelimiters = {
\ 'someFiletypeOfYours': { 'left': '#'}
\ }
You might also consider contributing a pull request to the project on GitHub, so as to have your new language and its comment delimiters be recognized by default by the plugin.
Upvotes: 2
Reputation: 53674
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
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.
Upvotes: 2