Visual Studio Code - duplicate selection ONLY
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.