There is a solution on how to duplicate a line. But how do I duplicate the selection? Like in Notepad++.
This extension worked for me:
https://marketplace.visualstudio.com/items?itemName=lafe.contextualduplicate
I then opened up my Keyboard Shortcuts to assign a memorable binding. In my case, I used <SHIFT><COMMAND>-D
so it behaves just like Sublime Text.
There is now a dedicated command, with VSCode 1.40 (Oct. 2019):
Duplicate selection
We have added a new action named Duplicate Selection.
- When executed, the current selection will be duplicated and the result will be selected.
- When there is no selection, the current line will be duplicated, all without writing to the system clipboard.
You can associate a keyboard shortcut to that command.
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