Closed gegoune closed 3 years ago
Apologies for opening old issue, but was thinking whether it would be possible to use above plugin's 'on demand' functionality. That is with enable_autocmd
set to false
, meaning that plugin itself does not run on CursorHold
but it is expected from comment plugin to invoke it. Kommentary solved it by providing hook_function
which can call nvim-ts-context-commentstring
's update_commentstring()
function. This can be set up for specific filetypes only.
Is that something you would be willing to seeing your plugin?
Thanks!
Hey, ATM I wanted to maintain v < 0.5 compatability, but once 0.5 is released I'm up for giving it ago... or if I find the time will do on a branch. Let's leave this open for now so i don't forget
Hey! Just wanted to let you know that integrating nvim-ts-context-commentstring
can be done without explicitly adding any Neovim 0.5 specific code. An easy way to do it would be to make the user configure it in a "hook" which is triggered before any commenting is done.
The user might configure it like this:
require('nvim_comment').setup({
hook = function()
-- They can do anything here, e.g.:
require('ts_context_commentstring.internal').update_commentstring()
end
})
A good place to trigger this hook might be the start of your comment_toggle
function or at any time before you read commentstring
.
Here's how b3nj5m1n/kommentary added a similar configuration option: https://github.com/b3nj5m1n/kommentary/issues/43
E: I just saw that this solution was mentioned above 😄
Hey does @gegoune PR cover your needs? I believe it does, but wanted to check in first. I've just asked to add some tests and made some comments on the PR
Hi, is it possible to comment with different comment strings based on cursor position in multi-context files like those of Vue and React? There is Shougo/context_filetype.vim which could help with figuring out the current context, but not sure how to make it work with
nvim-comment
.