nickspoons / vim-cs

Official Vim Runtime Files for C#
9 stars 3 forks source link

set commentstring in ftplugin #66

Closed dhduvall closed 2 months ago

dhduvall commented 1 year ago

Vim documents commentstring as

Currently only used to add markers for folding

which might explain why many filetype plugins don't set it; but I discovered that vim-commentary uses it, so I think it's helpful to have set usefully. I was surprised to find it prepending # to the commented-out lines, but that was probably because of some other plugin setting it globally instead of locally.

Easy workaround:

autocmd FileType cs setl commentstring=//%s
nickspoons commented 1 year ago

I'm not really sure if it's appropriate to set this, just for the sake of vim-commentary. Especially since the global vim default of /*%s*/ is valid in C#.

dhduvall commented 1 year ago

Fair enough. I didn't look for other users; I just hypothesized their existence. I'll defer to you on this. (I should definitely track down what plugin set it globally, though—that seems like a bug.)

nickspoons commented 1 year ago

You can find out where an option was set using :verbose, e.g.:

:verb set commentstring?