Get match from selection
This is a feature request:
If a single match-character is selected (e.g. a {), it should be used as a match-character, and sublimes build in matching can be used to find the matching bracket?
Hi Allan,
I'm not sure exactly what you're requesting here - can you please clarify? How would this differ from the current behaviour?
Thanks.
Ok, I can see why my thoughts aren't very clear :)
In the following, these symbols ⊣ ⊢ denote selection. Hence, it the bracket to the right is selected in foo[0], the notation would be foo[0⊣]⊢. A vertical bar (|) denote curser position.
Now suppose I want to change foo{0} into foo[0]. Then I would place my cursor is placed like like this foo{0|} or this foo{|0}, and invoke ChangeSurround with match argument { or }, and replace argument ].
It would however be nice if I could achieve the same by doing this:
foo{0⊣}⊢- Invoke ChangeSurround, which would recognize
}as the match input, and thus not ask for it - Input
]as replacement input.
I think a behaviour like this would grant the plugin a faster workflow, especially if the plugin just "listens" for the (one character) replacement input, but doesn't bring up a panel, and thus eliminates the need for pressing the Enter key as well. The curent way of doing things can stille be preserved, but this coud be a special behaviour, when a single pair character is selected.
I should also say that I don't know the Sublime API, and actually don't know it this is possible, but I really hope so :)
I realize that this might mostly be an issue on non-american keyboards, where characters like [ { ( ) } ] is obtained by annoying key combinations.
That makes sense - thanks.
What you're proposing sounds a bit tricky to get right in terms of interaction, but I take your point about non-american keyboards - I hadn't though of that.
I had a similar idea that it would be great to prepopulate the input panel for replacements so e.g. if you entered a single quote to match the replacement would default to a double quote and vice versa - but it turns out the API doesn't allow you to supply default input for input panels.
I'll think about this - not sure if/when I'll get time to do anything.