You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find it kind of annoying when I frequently encounter filetypes that are unknown to Comment.nvim, including plain text files without a set filetype, where it just says [Comment.nvim] Invalid commentstring for ! Read :h commentstring\ for help.
The editor Micro just has a default comment string of # %s for unknown filetypes, and I think that's especially useful because often times configuration files don't have a specific extension like .conf, and in that case, most often the comment string is #.
For my own use case, I'd really like to just set the default to # %s when the filetype is not known to Comment.nvim. But since this would be significantly changing the plugin's behavior, I'm not sure whether it's appropriate to set this as the default, or if it should be a configuration option, like require('Comment').setup({ default_comment_string = '# %s' }). I'm happy to try and do the implementation myself and update the docs, but I figured I'd ask first to see what you think about which implementation is most appropriate for the way you want the plugin to behave (and if you're fine with the change in the first place).
Thanks!
The text was updated successfully, but these errors were encountered:
@Amzd Thanks for the suggestion! I just tried this, but it doesn't seem to be working quite as expected. I put it inside my init.lua, and added a print statement:
and I get the "hello world" when loading files like .lua, .py, .js, etc. but if I have a plaintext file, or something like test.conf or test.filetypeunknown, the message doesn't print to the console. Could it be that the FileType event doesn't fire for files of an unknown type? Any idea if there's another way to accomplish this?
Hi,
I find it kind of annoying when I frequently encounter filetypes that are unknown to Comment.nvim, including plain text files without a set filetype, where it just says
[Comment.nvim] Invalid commentstring for ! Read :h commentstring\ for help.
The editor Micro just has a default comment string of
# %s
for unknown filetypes, and I think that's especially useful because often times configuration files don't have a specific extension like.conf
, and in that case, most often the comment string is#
.For my own use case, I'd really like to just set the default to
# %s
when the filetype is not known to Comment.nvim. But since this would be significantly changing the plugin's behavior, I'm not sure whether it's appropriate to set this as the default, or if it should be a configuration option, likerequire('Comment').setup({ default_comment_string = '# %s' })
. I'm happy to try and do the implementation myself and update the docs, but I figured I'd ask first to see what you think about which implementation is most appropriate for the way you want the plugin to behave (and if you're fine with the change in the first place).Thanks!
The text was updated successfully, but these errors were encountered: