Every so often, I copy multiple lines of code and then paste them into multiple selections expecting each selection to have that block of code, but instead the block of code gets split into the multiple selections because the number of lines/selections matched. That's the default behavior if the number of lines/selections match, which is useful but not in cases like this one.
My first instinct was to see if there was a shortcut to cancel that behavior as I'm pasting just like how "paste_and_indent"'s shortcut is "super+shift+v". I didn't find one though.
Every time I have this issue, I deselect one of the selections and paste, then select only the one I had deselected and paste.
If anyone knows of a better way of doing this, please share.
I think that the only one shot way is to create a plugin (Tools/New Plugin...
) that copies the clipboard into all selected regions:
import sublime, sublime_plugin
class FullMultilinePasteCommand(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
self.view.insert(edit, region.begin(), sublime.get_clipboard())
Save it in your Packages/User
directory.
Then you can add the key binding (Preferences/Key Bindings - User
):
{ "keys": ["alt+super+v"], "command": "full_multiline_paste" }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With