diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 7f4ae65..fb49d71 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -77,6 +77,13 @@ require("packer").startup(function() end, }) + use({ + "RRethy/nvim-treesitter-textsubjects", + config = function() + require("plugins.treesitter-textobjects") + end, + }) + -- formatter use({ "mhartington/formatter.nvim", diff --git a/.config/nvim/lua/plugins/treesitter-textobjects.lua b/.config/nvim/lua/plugins/treesitter-textobjects.lua new file mode 100644 index 0000000..c90b52c --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter-textobjects.lua @@ -0,0 +1,11 @@ +require("nvim-treesitter.configs").setup({ + textsubjects = { + enable = true, + prev_selection = ",", -- (Optional) keymap to select the previous selection + keymaps = { + ["."] = "textsubjects-smart", + [";"] = "textsubjects-container-outer", + ["i;"] = "textsubjects-container-inner", + }, + }, +})