You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ts-playground/plugin/nvim-treesitter-playground.lua

29 lines
964 B
Lua

-- setup playground module
require("nvim-treesitter-playground").init()
local api = vim.api
-- define highlights
local highlights = {
TSPlaygroundFocus = { link = "Visual", default = true },
TSQueryLinterError = { link = "Error", default = true },
TSPlaygroundLang = { link = "String", default = true },
}
for k, v in pairs(highlights) do
api.nvim_set_hl(0, k, v)
end
-- define commands
api.nvim_create_user_command("TSPlaygroundToggle", function()
require("nvim-treesitter-playground.internal").toggle()
end, {})
api.nvim_create_user_command("TSNodeUnderCursor", function()
require("nvim-treesitter-playground.hl-info").show_ts_node()
end, {})
api.nvim_create_user_command("TSCaptureUnderCursor", function()
require("nvim-treesitter-playground.hl-info").show_hl_captures()
end, {})
---@deprecated
api.nvim_create_user_command("TSHighlightCapturesUnderCursor", function()
require("nvim-treesitter-playground.hl-info").show_hl_captures()
end, {})