From 327ed2820ee451fe55e3d8c2739969fab0c49996 Mon Sep 17 00:00:00 2001 From: mequidis Date: Fri, 20 Jan 2023 20:40:43 +0200 Subject: [PATCH] nvim: add treesitter textobjcets --- .config/nvim/lua/plugins.lua | 7 +++++++ .config/nvim/lua/plugins/treesitter-textobjects.lua | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 .config/nvim/lua/plugins/treesitter-textobjects.lua 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", + }, + }, +})