summaryrefslogtreecommitdiff
path: root/lua/default-config.lua
diff options
context:
space:
mode:
authorAnshuman Medhi <[email protected]>2021-07-06 07:48:58 +0800
committerGitHub <[email protected]>2021-07-05 19:48:58 -0400
commit6258b2b4bab1964f36279e16afc093306b35d006 (patch)
tree231d278d3c1cc36220f81251096623d94721e6e5 /lua/default-config.lua
parentf7aeeba663666b75ab0063f786d21648c0c71766 (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/default-config.lua')
-rw-r--r--lua/default-config.lua29
1 files changed, 26 insertions, 3 deletions
diff --git a/lua/default-config.lua b/lua/default-config.lua
index e05fc9e3..bd996acd 100644
--- a/lua/default-config.lua
+++ b/lua/default-config.lua
@@ -30,6 +30,29 @@ O = {
ignore_install = { "haskell" },
highlight = { enabled = true },
rainbow = { enabled = false },
+ -- The below are for treesitter-textobjects plugin
+ textobj_prefixes = {
+ goto_next = "]", -- Go to next
+ goto_previous = "[", -- Go to previous
+ inner = "i", -- Select inside
+ outer = "a", -- Selct around
+ swap = "<leader>a", -- Swap with next
+ },
+ textobj_suffixes = {
+ -- Start and End respectively for the goto keys
+ -- for other keys it only uses the first
+ ["function"] = { "f", "F" },
+ ["class"] = { "m", "M" },
+ ["parameter"] = { "a", "A" },
+ ["block"] = { "k", "K" },
+ ["conditional"] = { "i", "I" },
+ ["call"] = { "c", "C" },
+ ["loop"] = { "l", "L" },
+ ["statement"] = { "s", "S" },
+ ["comment"] = { "/", "?" },
+ },
+ -- The below is for treesitter hint textobjects plugin
+ hint_labels = { "h", "j", "f", "d", "n", "v", "s", "l", "a" },
},
lsp = {
@@ -46,6 +69,9 @@ O = {
zen = { active = false },
ts_playground = { active = false },
ts_context_commentstring = { active = false },
+ ts_hintobjects = { active = false },
+ ts_textobjects = { active = false },
+ ts_textsubjects = { active = false },
telescope_fzy = { active = false },
telescope_project = { active = false },
indent_line = { active = false },
@@ -81,9 +107,6 @@ O = {
sanegx = { active = false },
snap = { active = false },
tabnine = { active = false },
-
-
-
},
custom_plugins = {