This repository has been archived on 2025-01-07. You can view files and clone it, but cannot push or open issues or pull requests.
opdavies.nvim/after/plugin/treesitter.lua

49 lines
913 B
Lua
Raw Normal View History

local has_configs, configs = pcall(require, "nvim-treesitter.configs")
if not has_configs then
return
end
configs.setup {
2023-01-30 22:07:04 +00:00
autotag = {
enable = true,
},
context_commenting = {
enable = true,
},
highlight = {
enable = true,
},
indent = {
disable = { "yaml" },
enable = true,
},
matchup = {
enable = true,
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
},
}
local nmap = require("opdavies.keymap").nmap
nmap { "<leader>th", "<cmd>TSHighlightCapturesUnderCursor<CR>" }
nmap { "<leader>tp", "<cmd>TSPlaygroundToggle<CR>" }
local has_context, context = pcall(require, "treesitter-context")
if not has_context then
return
end
context.setup { enable = true }