2

Is it possible to duplicate a selected / highlighted text to the right of the cursor in VS Code?

Meaning:

before: 123

after: 123123

In Sublime it is possible to do using CMD+SHIFT+D.

Eduard
  • 8,437
  • 10
  • 42
  • 64
  • @Vega - none of those suggestions, all about copying lines up/down, do what the OP wants. I have answered it below with a more recent command. – Mark Feb 01 '20 at 17:54

4 Answers4

2

No, the feature is not available. see feature request

You can do line duplication.VS Code has two shortcuts

Shift+Alt+Down Copy Line Down editor.action.copyLinesDownAction

Shift+Alt+Up Copy Line Up editor.action.copyLinesUpAction

keyboard shortcuts

Eldho
  • 7,795
  • 5
  • 40
  • 77
2

its important for developers to create duplicate

like ctrl + D in Notepad++
link ctrl + shift + D in SublimeText

it is not available in VSCode

you can try ctrl + drag mouse

2

There is now a editor.action.duplicateSelection command (unbound to any default keybinding) that does exactly what you want. For example,

{
  "key": "alt+m",         // or whatever keybinding you wish
  "command": "editor.action.duplicateSelection"
}
Mark
  • 143,421
  • 24
  • 428
  • 436
-1

If it is possible you will can customize your own shortcut in the configurations.

You can press cmd + k , cmd + s to open the shortcuts editor then you can find for “duplicate” word in the searchbar.

I think is better that I teach you know how to fish, not give you a fish