Repository navigation
Replies: 2 comments 2 replies
|
You need to overwrite the |
2 replies
|
Return the outer range minus the inner delete = function()
local config = require("nvim-surround.config")
local ts = require("nvim-surround.treesitter")
local outer = config.get_selection({ query = { capture = "@block.outer", type = "textobjects" } })
local node = outer and require("nvim-surround.queries").get_node(outer)
if not node then
return nil
end
for child in node:iter_children() do
if child:type() == "block" then
local inner = ts.get_node_selection(child)
return {
left = { first_pos = outer.first_pos, last_pos = { inner.first_pos[1], inner.first_pos[2] - 1 } },
right = { first_pos = { inner.last_pos[1], inner.last_pos[2] + 1 }, last_pos = outer.last_pos },
}
end
end
end,Drop that next to your |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I want to implement a surround that can delete the surrounding block. So for example in lua when I have
I want a surround that lets me turn this into
When I do
Only the "i" from
ifand "d" fromendget deleted when I dodsy. What did I miss?All reactions