summaryrefslogtreecommitdiffstatshomepage
path: root/nvim/.config
diff options
context:
space:
mode:
Diffstat (limited to 'nvim/.config')
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins.lua3
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/surround.lua15
-rw-r--r--nvim/.config/nvim/lua/tobyvin/plugins/treesitter.lua11
3 files changed, 26 insertions, 3 deletions
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins.lua b/nvim/.config/nvim/lua/tobyvin/plugins.lua
index 47def50..bac550b 100644
--- a/nvim/.config/nvim/lua/tobyvin/plugins.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins.lua
@@ -257,6 +257,7 @@ M.plugins = function(use)
"nvim-treesitter/nvim-treesitter-refactor",
"nvim-treesitter/nvim-treesitter-textobjects",
"nvim-treesitter/nvim-treesitter-context",
+ "RRethy/nvim-treesitter-textsubjects",
"JoosepAlviste/nvim-ts-context-commentstring",
"mfussenegger/nvim-ts-hint-textobject",
},
@@ -411,7 +412,7 @@ M.plugins = function(use)
use({
"ur4ltz/surround.nvim",
config = function()
- require("surround").setup({ mappings_style = "surround" })
+ require("tobyvin.plugins.surround").setup()
end,
})
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/surround.lua b/nvim/.config/nvim/lua/tobyvin/plugins/surround.lua
new file mode 100644
index 0000000..d1f3405
--- /dev/null
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/surround.lua
@@ -0,0 +1,15 @@
+local M = {}
+
+M.setup = function()
+ local status_ok, surround = pcall(require, "surround")
+ if not status_ok then
+ vim.notify("Failed to load module 'surround'", "error")
+ return
+ end
+
+ surround.setup({
+ map_insert_mode = false,
+ })
+end
+
+return M
diff --git a/nvim/.config/nvim/lua/tobyvin/plugins/treesitter.lua b/nvim/.config/nvim/lua/tobyvin/plugins/treesitter.lua
index 9908bcc..72bb6ff 100644
--- a/nvim/.config/nvim/lua/tobyvin/plugins/treesitter.lua
+++ b/nvim/.config/nvim/lua/tobyvin/plugins/treesitter.lua
@@ -29,11 +29,18 @@ M.setup = function()
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
- ["ac"] = "@class.outer",
- ["ic"] = "@class.inner",
},
},
},
+ textsubjects = {
+ enable = true,
+ prev_selection = ",", -- (Optional) keymap to select the previous selection
+ keymaps = {
+ ["."] = "textsubjects-smart",
+ ["ac"] = "textsubjects-container-outer",
+ ["ic"] = "textsubjects-container-inner",
+ },
+ },
})
end