nvim-surround
nvim-surround copied to clipboard
Ability to delete a surround similar to how we can add a surround(re: textobjects)
Checklist
- [X] Have you read through
:h nvim-surround
to see if there might be any relevant information there?
Is your feature request related to a problem? Please describe. If I have a buffer like this:
("here_are_|some_words")
I can do ysa"_
to give me:
(_"here_are_|some_words"_)
if I want to delete a surround ds_
, I get:
(_"here_are|somewords"_)
What would be awesome is if I could delete similar to how I can add. So something like dsa"_
([D]elete [S]urround [A]round ["]quote [_]undescore`
("here_are_|some_words")
I understand that these keymaps are a bit unvim-like, and would conflict with the existing ones(i.e. dsa"_
would trigger dsa
which would delete the closest surrounding a
), so maybe an alternative, more vim-like approach, would be to have this only work in visual mode. So it would be more like va"D_
(D
being an example key for triggered surround delete in visual mode). Then it would work just like the existing delete functionality, except instead of finding the closest surround to the cursor, it finds the closest surround to the edges of the visual selection.
Additional context I did take a look at the existing code to see if I could easily implement it with existing functions, but it seemed like the current delete functionality is all cursor/single position based. I would be happy to take a stab at it, but wanted to check first if this was something you'd be interested in adding to the plugin or not, or if you had any suggestions on the best way to implement it.
Thanks! And I appreciate all your work on this plugin. It's one of my most used, if the not the most used plugin for me.
EDIT: I changed the
(spaces) to _
underscore to make it more clear.