feat(toggle): add keymap to toggle treesitter context (#1711)

* feat: add keymap to toggle treesitter context

* fix: get correct enabled state

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
This commit is contained in:
Kevin Traver 2023-10-14 06:40:25 -06:00 committed by GitHub
parent f724eae2e3
commit 5e1a86d3b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -110,6 +110,22 @@ return {
event = "LazyFile",
enabled = true,
opts = { mode = "cursor" },
keys = {
{
"<leader>ut",
function()
local Util = require("lazyvim.util")
local tsc = require("treesitter-context")
tsc.toggle()
if Util.inject.get_upvalue(tsc.toggle, "enabled") then
Util.info("Enabled Treesitter Context", { title = "Option" })
else
Util.warn("Disabled Treesitter Context", { title = "Option" })
end
end,
desc = "Toggle Treesitter Context",
},
},
},
-- Automatically add closing tags for HTML and JSX