diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index a47a305..978cfdf 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -58,6 +58,7 @@ "nvim-treesitter": { "branch": "master", "commit": "8b79cddc708cb8549562f0101f7f509ad7cebf97" }, "nvim-treesitter-context": { "branch": "master", "commit": "198720b4016af04c9590f375d714d5bf8afecc1a" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "cb718aab7fa66e43187674e875713097492a6618" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "143856b1cee509a190cc8c17ddb0638002171235" }, "nvim-treesitter-textsubjects": { "branch": "master", "commit": "abcbb0e537c9c24800b03b9ca33bee5806604629" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua index 50a3edc..65d716e 100644 --- a/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -5,6 +5,7 @@ return { -- show current cursor context at top of buffer -- improves commenting plugin above by using ts dependencies = { + { "nvim-treesitter/nvim-treesitter-textobjects" }, -- nice context on top of buffer { "nvim-treesitter/nvim-treesitter-context", opts = { max_lines = 3 } }, "JoosepAlviste/nvim-ts-context-commentstring", @@ -44,23 +45,35 @@ return { end, additional_vim_regex_highlighting = false, }, - incremental_selection = { enable = true }, - textobjects = { + incremental_selection = { enable = true, - -- TODO: CHECK IF ANY CONFLICTING WITH MINI AI!! - -- supported in other languages as well - ["aF"] = "@function.outer", - ["iF"] = "@function.inner", - ["aL"] = "@loop.outer", - ["iL"] = "@loop.inner", - ["aC"] = "@conditional.outer", - ["iC"] = "@conditional.inner", - ["iS"] = "@statement.inner", - ["aS"] = "@statement.outer", + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + textobjects = { + select = { + enable = true, + -- TODO: CHECK IF ANY CONFLICTING WITH MINI AI!! + -- supported in other languages as well + keymaps = { + ["aF"] = { query = "@function.outer", desc = "function outer" }, + ["iF"] = { query = "@function.inner", desc = "function inner" }, + ["aL"] = { query = "@loop.outer", desc = "loop outer" }, + ["iL"] = { query = "@loop.inner", desc = "loop inner" }, + ["aC"] = { query = "@conditional.outer", desc = "conditional inner" }, + ["iC"] = { query = "@conditional.inner", desc = "conditional inner" }, + ["aS"] = { query = "@statement.outer", desc = "statement outer" }, + ["iS"] = { query = "@statement.inner", desc = "statement inner" }, - -- Nushell only - ["aP"] = "@pipeline.outer", - ["iP"] = "@pipeline.inner", + -- Nushell only + ["aP"] = { query = "@pipeline.outer", desc = "pipeline outer" }, + ["iP"] = { query = "@pipeline.inner", desc = "pipeline inner" }, + }, + }, }, indent = { enable = true }, autotag = { enable = true },