File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,35 @@ require("nvim_comment").setup({
264264})
265265```
266266
267+ #### [ ` Comment.nvim ` ] ( https://github.com/numToStr/Comment.nvim )
268+
269+ First, disable the ` CursorHold ` autocommand of this plugin:
270+
271+ ``` lua
272+ require ' nvim-treesitter.configs' .setup {
273+ context_commentstring = {
274+ enable = true ,
275+ enable_autocmd = false ,
276+ }
277+ }
278+ ```
279+
280+ Then, configure ` Comment.nvim ` to trigger the ` commentstring ` updating logic
281+ with its ` pre_hook ` configuration:
282+
283+ ``` lua
284+ require (' Comment' ).setup {
285+ pre_hook = function (ctx )
286+ local U = require ' Comment.utils'
287+ local type = ctx .ctype == U .ctype .line and ' __default' or ' __multiline'
288+ return require (' ts_context_commentstring.internal' ).calculate_commentstring {
289+ key = type ,
290+ }
291+ end ,
292+ }
293+ ```
294+
295+
267296## More demos
268297
269298** React:**
You can’t perform that action at this time.
0 commit comments