feat(treesitter-context): which-key toggle

This commit is contained in:
Stefan Boca 2024-07-15 11:55:28 -07:00
parent dc8a3a139e
commit 0aaebbd5ae

View file

@ -1,21 +1,22 @@
-- Show context of the current function -- Show context of the current function
return { return {
"nvim-treesitter/nvim-treesitter-context", "nvim-treesitter/nvim-treesitter-context",
event = "LazyFile", event = "VeryLazy",
opts = { mode = "cursor", max_lines = 3 }, opts = function()
keys = {
{
"<leader>ut",
function()
local tsc = require("treesitter-context") local tsc = require("treesitter-context")
tsc.toggle()
if LazyVim.inject.get_upvalue(tsc.toggle, "enabled") then LazyVim.toggle.map("<leader>ut", {
LazyVim.info("Enabled Treesitter Context", { title = "Option" }) name = "Treesitter Context",
get = tsc.enabled,
set = function(state)
if state then
tsc.enable()
else else
LazyVim.warn("Disabled Treesitter Context", { title = "Option" }) tsc.disable()
end end
end, end,
desc = "Toggle Treesitter Context", })
},
}, return { mode = "cursor", max_lines = 3 }
end,
} }