Closed svenXY closed 2 years ago
If you check out the wiki, you'll find that ds
and cs
don't take text-objects as "arguments". I think the idea of deletions via visual selections isn't something that I'll add, since you can probably just delete them manually if you're already taking the time to visually select it. It would also introduce a whole host of issues like:
This isn't to say that I'm completely disinterested in this enhancement; I'm curious to understand which circumstances you find yourself in where a quote spanning several lines happens. There are a few things to consider when implementing this, including
vim-surround
(which doesn't allow you to modify multi-line quotes)a"
text-object does not span several lines)nvim-surround
tell which pair to modify, e.g.
"This would be string
number one" [cursor here] "this would
be string number two"
I think it's fairly clear to me that ds"
in this case should delete the second pair of quotes, but it's a bit ambiguous implementation-wise.
I'm currently thinking through #101, to see if there's a way I can implement "more custom" modifications to surrounding pairs that doesn't involve relying on Vim's built-in text-objects.
hI, sorry for answering late.... To be quite honest, the usecase occurred to me when I copy-pasted something with mutliple lines and it had quotes around it. I tried the usual, read the documentation and realized that many motions are not possible for cs and ds - and that was when I came up with the solution.
But I agree that it is not a veeeeery common case and that many questions woud have to be answered first, so I'm fine to close this.
Thanks for thinking about it!
Cheers, Sven
@svenXY On the new branch pattern-matching
(see #101) there is a way to have ds"
delete quotes across lines by default (or some other key), but it comes at the cost of probably not being nearly as accurate with detecting what constitute "valid strings". I'll look into it a bit more.
If you're interested, the related configuration is
['"'] = {
add = function()
return { { '"' }, { '"' } }
end,
find = '".-"',
delete = '^(")().-(")()$',
change = {
target = '^(")().-(")()$',
},
},
in the delimiters
table, although I would read through the most recent messages I've sent in #101, since there are a lot of changes to how user configuration works.
Checklist
:h nvim-surround
to see if there might be any relevant information there?Describe the solution you'd like I have a quote over a few lines and want to remove the quotation marks. Neither dsap" or - in my case - dsG" work.
Also, there is no possibility to make a visual selection and the delete based on the selection, which would also satisfy my usecase.