fix(nvim): treesitter textobject bindings for Go
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Rob Watson 2025-01-11 08:38:17 +01:00
parent 8d45a4cc6e
commit 68acd1fcac
2 changed files with 14 additions and 8 deletions

View File

@ -40,15 +40,15 @@ require("nvim-treesitter.configs").setup({
enable = true,
lookahead = true,
keymaps = {
["ak"] = "@keyed_element.outer",
["iv"] = "@keyed_element.inner",
["av"] = "@keyed_element.inner",
["ak"] = "@kv_element.all",
["ik"] = "@kv_element.key",
["iv"] = "@kv_element.value",
["av"] = "@kv_element.all",
["at"] = "@composite_literal",
["ia"] = "@parameter.inner",
["aa"] = "@parameter.outer",
["ac"] = "@comment.outer",
["as"] = "@statement.outer",
["ar"] = "@return",
["af"] = "@function.outer",
["if"] = "@function.inner",
},

View File

@ -4,8 +4,14 @@
;; @keyed_element.outer => key and value
;; @keyed_element.inner => value
(keyed_element (_) . (_) @keyed_element.inner) @keyed_element.outer
(field_declaration type: (_) @keyed_element.inner) @keyed_element.outer
(parameter_declaration type: (_) @keyed_element.inner) @keyed_element.outer
(keyed_element . ((_) @kv_element.key))
(keyed_element ((_) @kv_element.value) .)
(keyed_element) @kv_element.all
(composite_literal (_)) @composite_literal
(parameter_declaration) @kv_element.all
(parameter_declaration . ((_) @kv_element.key))
(parameter_declaration ((_) @kv_element.value) .)
(field_declaration) @kv_element.all
(field_declaration . ((_) @kv_element.key))
(field_declaration ((_) @kv_element.value) .)