I want to duplicate the current line to a new line below it. I found this post but I can't find the option they're talking about (editor.action.copyLinesDownAction
) in options > keyboard.
How do we do this in 2017?
Click anywhere on the line you want to duplicate (do not select the text), press Ctrl+C, and press Ctrl+V to create the duplicated line. You can duplicate that line to anywhere now, not just to next line and it will insert the line above the selected line. e.g.
427 string foo = "text";
428
429 string bar = "other";
Click anywhere on line 427 and press Ctrl+C. Click on line 429 and press Ctrl+V
427 string foo = "text";
428
429 string foo = "text";
430 string bar = "other";
I'm not sure if this is a new feature from one of the updates but the following key combination works for me in VS 2017 (v 15.7.3):
Ctrl + E,V
This duplicates the current line that the cursor is on or it will duplicate any selected text and you won't lose the contents stored in the clipboard.
I have not tried remapping that command to a different key combination.
Found an extension that does this right here. Hope this helps people.
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