Closed andrewferrier closed 2 years ago
I was also thinking about this considering if your file is quite large, the surrounding braces might not even be on the screen. I might consider adding an option for this, but I'm pretty sure vim-surround would exhibit the same behavior
Yeah, I just checked and you are correct - vim-surround
does behave the same way (which doesn't mean that's the right way, but does at least mean you are consistent ;). I wouldn't object strongly if you closed this. In effect, what I'm asking for here would be a special case that could be confusing.
I'll leave this open for a bit in case others would like to think about it, but I think that logically speaking the "jumping" is currently quite simple, e.g. prefer not jumping, then forwards, then reverse. Adding this edge case could be quite confusing (and also would require additional logic haha)
@andrewferrier I think ideally I would want to open up a discussions thread for this, but I feel like nobody checks it :/ I wish polls would "notify" everybody that looks at this repo
I would prefer to match how it works currently. When "inside" a pair of braces (of any kind), my expectation is that all actions will interact with them and not later braces I'm not currently inside. I might be biased because I work in a lisp (Clojure), but to me, interacting with the surrounding braces is the most important part of a "surround" plugin.
@NoahTheDuke Indeed with so "controversial" a change as this one I would most definitely make it a user-defined option in settings, but in any case I'm leaning towards not implementing it at all for simplicity reasons
Closing this as I don't intend on adding this to the plugin.
Checklist
main
branch?:h nvim-surround
to see if there might be any relevant information there?To Reproduce Buffer:
Place cursor on c, type
c(
Expected behavior The braces surrounding
"xyz"
are highlighted ready for replacementActual behavior The braces after
b
and on the standalone line are highlighted ready for replacementExplanation It seems to me that in general if
nvim-surround
is not on the replacements, it would want to look forward first - at least on the same line. I get that if it's inside the braces (which to be fair it is for the wider braces), that seems like the right ones to pick up, but I wonder if a special case for the current line would make sense?