Skip to content

mini.comment: change the default commentstring for a filetype #332

Closed Answered by echasnovski
krishna-bala asked this question in Q&A
Discussion options

You must be logged in to vote

I would like to change the default commentstring for c/cpp files from /* %s */ to // %s when using mini.comment. In the mini-comment.txt documentation, it mentions that

Comment structure is inferred from 'commentstring': either from current
buffer or from locally active tree-sitter language (only on Neovim>=0.9).

I am using neovim 0.9.0, so I believe the commentstring is inferred from the active tree-sitter language. Is there a way to modify the active tree-sitter language so that I can change the default commentstring for a given filetype?

Sure, by using one of the "usual" ways to modify 'commentstring' for a filetype:

  • (highly suggested) Create an 'after/ftplugin/c.lua' file in your…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@krishna-bala
Comment options

@echasnovski
Comment options

@mangkoran
Comment options

Answer selected by echasnovski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants