Vintage
Vintage copied to clipboard
's' after selecting text in visual mode off-by-one issue
When selecting text in visual mode, then hitting 's' (to Substitute text), the character after the selection is also deleted.
So if the text is
helloc
and I just select hello, then I would expect to be left with c, but instead the whole string is deleted.
Is this a legit bug, or is there a setting controlling this?
I posted this problem in the forum long time ago. No one really cares, it seemed.
It would be great if anyone can fix this. Actually, 'c' is quite similar and it works fine. It would work, when there's text selected, let 's' works as the same as 'c'.
Hmm, now that I know to use 'c', I think I'll be ok. I might be able to map 's' to 'c' via config. If not, then I should be able to. Anyway, thanks for showing me that!
I fixed this by changing the motion mapped to the "s" key, in Default.sublime-keymap Try this:
{ "keys": ["s"], "command": "set_action_motion", "args": {
"action": "enter_insert_mode",
"action_args": {"insert_command": "vi_delete"},
"motion": "expand_selection" },
"context": [{"key": "setting.command_mode"}]
}
@alexleach beautiful.
@princemaple Glad you like it :)
Just discovered a flaw in it though, in that the character under the cursor doesn't get deleted when not in visual mode. I've added a new commit on the above Pull Request that fixes this. (change vi_delete for vi_right_delete)
:+1: