Reason: sometimes there is a need to copy a block of text within the same file and replace some words within copied block.
Ctrl-Shift-V would be a good combination for the command.
Also consider opening Replace window with Selected text option active. i.e. the command will do three actions in one:
Many times after I paste a block of text and find indent is needed, and I have to re-select this pasted block and press tab. So this feature could be very useful to me!
I think we can make selected pasted text by modifying paste-and-indent and remap the paste key.
Another way is to use VSCodeVim and finish https://github.com/VSCodeVim/Vim/pull/3672/commits/29d7a1a34429be1f58717cc6ea4131c0fb513d33
We only need a brave hero to implement it
I often have the opposite use-case, where I want to highlight some text and then paste it multiple times to duplicate it. This workflow would be broken with this suggestion. This functionality should be toggle-able.
I wonder if this also has implications on mutli-cursor highlighting and pasting over top of the selection.
Another issue I'm running into with this behavior:
Highlight a block of text, paste in a replacement, and start typing to add on to the end of it.
@TheSench I don't think anyone is suggesting changing the normal paste behaviour (it would be super disorienting to deviate from what basically all other software does). This would be an additional action.
@borsboom I would hope so. Unfortunately, the current version of the insider's release was behaving this way today. I originally ended up here from #59881 which did seem to be advocating for changing the default paste behavior. I think I may have mixed that issue up with this one (which is very clearly advocating for an additional "paste-and-highlight" action.
I ended up here for a similar issue. Unless I'm remembering wrong, pasting over selected text didn't use to select the now pasted text. Is there a way to toggle this off?
The fix proposed in issue 82802 worked for me.
Changing the default paste behavior would be quite disruptive. It makes more sense to add a new command and let users configure their own key bindings.
If you guys are using vim, just
We try to keep VS Code lean and we think the functionality you're asking for is great for a VS Code extension. Maybe you can already find one that suits you in the VS Code Marketplace. Just in case, in a few simple steps you can get started writing your own extension. See also our issue reporting guidelines.
Happy Coding!
Most helpful comment
Many times after I paste a block of text and find indent is needed, and I have to re-select this pasted block and press tab. So this feature could be very useful to me!