diff options
author | Anshuman Medhi <[email protected]> | 2021-07-06 07:48:58 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-05 19:48:58 -0400 |
commit | 6258b2b4bab1964f36279e16afc093306b35d006 (patch) | |
tree | 231d278d3c1cc36220f81251096623d94721e6e5 /lua/plugins.lua | |
parent | f7aeeba663666b75ab0063f786d21648c0c71766 (diff) |
Add Treesitter extensions for better textobjects (#700)
This adds three plugins that use treesitters parsing to provide smarter text objects
[ts_textobjects](https://github.com/nvim-treesitter/nvim-treesitter-textobjects) lets you define text objects for things like functions and classes
[ts_textsubjects](https://github.com/RRethy/nvim-treesitter-textsubjects.git) defines a smart text object that selects a semantic block around the cursor
[ts_hintobjects](https://github.com/mfussenegger/nvim-ts-hint-textobject) uses easymotion style hint labeling to show all the surrounding semantic blocks, letting you choose the correct one
I have also added which-key entries for all the above
Co-authored-by: Christian Chiarulli <[email protected]>
Diffstat (limited to 'lua/plugins.lua')
-rw-r--r-- | lua/plugins.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lua/plugins.lua b/lua/plugins.lua index aadca5d6..86c2c628 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -478,6 +478,24 @@ return require("packer").startup(function(use) requires = "hrsh7th/nvim-compe", disable = not O.plugin.tabnine.active, } + + -- Custom semantic text objects + use { + "nvim-treesitter/nvim-treesitter-textobjects", + disable = not O.plugin.ts_textobjects.active, + } + -- Smart text objects + use { + "RRethy/nvim-treesitter-textsubjects", + disable = not O.plugin.ts_textsubjects.active, + } + -- Text objects using hint labels + use { + "mfussenegger/nvim-ts-hint-textobject", + event = "BufRead", + disable = not O.plugin.ts_hintobjects.active, + } + for _, plugin in pairs(O.custom_plugins) do packer.use(plugin) end |