2022-09-01 20:58:44 +00:00
|
|
|
local has_configs, configs = pcall(require, "nvim-treesitter.configs")
|
|
|
|
if not has_configs then
|
2021-12-23 23:13:45 +00:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
configs.setup {
|
2021-11-17 09:00:00 +00:00
|
|
|
context_commenting = {
|
2022-01-09 00:07:35 +00:00
|
|
|
enable = true,
|
2021-11-17 09:00:00 +00:00
|
|
|
},
|
2022-08-16 15:00:30 +00:00
|
|
|
ensure_installed = {
|
|
|
|
"bash",
|
|
|
|
"comment",
|
|
|
|
"css",
|
|
|
|
"dockerfile",
|
|
|
|
"go",
|
|
|
|
"html",
|
|
|
|
"javascript",
|
|
|
|
"json",
|
|
|
|
"lua",
|
|
|
|
"make",
|
|
|
|
"markdown",
|
|
|
|
"php",
|
|
|
|
"regex",
|
|
|
|
"rst",
|
|
|
|
"scss",
|
|
|
|
"typescript",
|
|
|
|
"vim",
|
|
|
|
"vue",
|
|
|
|
"yaml",
|
|
|
|
},
|
2021-11-17 09:00:00 +00:00
|
|
|
highlight = {
|
|
|
|
enable = true,
|
2021-12-24 13:00:00 +00:00
|
|
|
},
|
|
|
|
indent = {
|
2022-01-03 20:46:22 +00:00
|
|
|
disable = { "yaml" },
|
2021-12-24 13:00:00 +00:00
|
|
|
enable = true,
|
2022-01-09 00:07:35 +00:00
|
|
|
},
|
2022-03-31 00:13:30 +00:00
|
|
|
matchup = {
|
|
|
|
enable = true,
|
2022-05-11 09:04:33 +00:00
|
|
|
},
|
|
|
|
textobjects = {
|
|
|
|
select = {
|
|
|
|
enable = true,
|
|
|
|
lookahead = true,
|
|
|
|
|
|
|
|
keymaps = {
|
|
|
|
["af"] = "@function.outer",
|
|
|
|
["if"] = "@function.inner",
|
|
|
|
["ac"] = "@class.outer",
|
|
|
|
["ic"] = "@class.inner",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-11-17 09:00:00 +00:00
|
|
|
}
|
2022-04-03 19:45:24 +00:00
|
|
|
|
2022-09-01 20:58:44 +00:00
|
|
|
local nmap = require("opdavies.keymap").nmap
|
2022-04-03 19:45:24 +00:00
|
|
|
|
2022-09-01 20:58:44 +00:00
|
|
|
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 }
|