feat(mini.comment): added ts-context-commentstring back and made it work with mini.comment
This commit is contained in:
@ -131,9 +131,18 @@ return {
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- comments
|
-- comments
|
||||||
|
{ "JoosepAlviste/nvim-ts-context-commentstring", lazy = true },
|
||||||
{
|
{
|
||||||
"echasnovski/mini.comment",
|
"echasnovski/mini.comment",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
|
config = function(_, opts)
|
||||||
|
local c = require("mini.comment")
|
||||||
|
c.setup(opts)
|
||||||
|
local H = require("lazyvim.util").get_upvalue(c.setup, "H")
|
||||||
|
H.get_commentstring = function()
|
||||||
|
return require("ts_context_commentstring.internal").calculate_commentstring() or vim.bo.commentstring
|
||||||
|
end
|
||||||
|
end,
|
||||||
opts = {},
|
opts = {},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -27,6 +27,20 @@ function M.fg(name)
|
|||||||
return fg and { fg = string.format("#%06x", fg) }
|
return fg and { fg = string.format("#%06x", fg) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.get_upvalue(func, name)
|
||||||
|
local i = 1
|
||||||
|
while true do
|
||||||
|
local n, v = debug.getupvalue(func, i)
|
||||||
|
if not n then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if n == name then
|
||||||
|
return v
|
||||||
|
end
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
---@param fn fun()
|
---@param fn fun()
|
||||||
function M.on_very_lazy(fn)
|
function M.on_very_lazy(fn)
|
||||||
vim.api.nvim_create_autocmd("User", {
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
Reference in New Issue
Block a user