feat(treesitter-context): which-key toggle (#4059)
## Description Add a which-key toggle for treesitter-context ## Screenshots  ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
This commit is contained in:
@ -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 = {
|
local tsc = require("treesitter-context")
|
||||||
{
|
|
||||||
"<leader>ut",
|
LazyVim.toggle.map("<leader>ut", {
|
||||||
function()
|
name = "Treesitter Context",
|
||||||
local tsc = require("treesitter-context")
|
get = tsc.enabled,
|
||||||
tsc.toggle()
|
set = function(state)
|
||||||
if LazyVim.inject.get_upvalue(tsc.toggle, "enabled") then
|
if state then
|
||||||
LazyVim.info("Enabled Treesitter Context", { title = "Option" })
|
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,
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user