From 8014928cbf971711cf086a0729981245f5d1c4e0 Mon Sep 17 00:00:00 2001 From: Kevin Traver Date: Fri, 13 Oct 2023 18:56:40 -0600 Subject: [PATCH] feat: add keymap to toggle treesitter context --- lua/lazyvim/plugins/treesitter.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lua/lazyvim/plugins/treesitter.lua b/lua/lazyvim/plugins/treesitter.lua index c833a707..60eb14f8 100644 --- a/lua/lazyvim/plugins/treesitter.lua +++ b/lua/lazyvim/plugins/treesitter.lua @@ -110,6 +110,23 @@ return { event = "LazyFile", enabled = true, opts = { mode = "cursor" }, + keys = { + { + "ut", + function() + local Util = require("lazy.core.util") + require("treesitter-context").toggle() + if require("treesitter-context.config").enable then + require("treesitter-context.config").enable = false + Util.warn("Disabled Treesitter Context", { title = "Option" }) + else + require("treesitter-context.config").enable = true + Util.info("Enabled Treesitter Context", { title = "Option" }) + end + end, + desc = "Toggle Treesitter Context", + }, + }, }, -- Automatically add closing tags for HTML and JSX