mirror of
https://github.com/LazyVim/starter.git
synced 2026-07-25 05:51:04 +00:00
Add treesitter context
This commit is contained in:
parent
07c65128fb
commit
c20880fc7d
2 changed files with 21 additions and 20 deletions
21
lua/plugins/treesitter-context.lua
Normal file
21
lua/plugins/treesitter-context.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
return {
|
||||||
|
"nvim-treesitter/nvim-treesitter-context",
|
||||||
|
-- event = "LazyFile",
|
||||||
|
opts = { mode = "cursor", max_lines = 3 },
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>ut",
|
||||||
|
function()
|
||||||
|
local tsc = require("treesitter-context")
|
||||||
|
tsc.toggle()
|
||||||
|
-- TODO: Convert this message to plain nvim
|
||||||
|
-- if LazyVim.inject.get_upvalue(tsc.toggle, "enabled") then
|
||||||
|
-- LazyVim.info("Enabled Treesitter Context", { title = "Option" })
|
||||||
|
-- else
|
||||||
|
-- LazyVim.warn("Disabled Treesitter Context", { title = "Option" })
|
||||||
|
-- end
|
||||||
|
end,
|
||||||
|
desc = "Toggle Treesitter Context",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
return {
|
|
||||||
"nvim-treesitter/nvim-treesitter-context",
|
|
||||||
event = "LazyFile",
|
|
||||||
opts = { mode = "cursor", max_lines = 3 },
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
"<leader>ut",
|
|
||||||
function()
|
|
||||||
local tsc = require("treesitter-context")
|
|
||||||
tsc.toggle()
|
|
||||||
if LazyVim.inject.get_upvalue(tsc.toggle, "enabled") then
|
|
||||||
LazyVim.info("Enabled Treesitter Context", { title = "Option" })
|
|
||||||
else
|
|
||||||
LazyVim.warn("Disabled Treesitter Context", { title = "Option" })
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
desc = "Toggle Treesitter Context",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue