Vscode - Shortcut to Copy Current Line

What is the shortcut to copy current line in VSCode?

I know we can Ctrl+L to select the line then Ctrl+C to copy. But is there any better solution. For example, in Geany, we can Ctrl+Shift+C to copy the line where the cursor is.

To be clear I am not talking about Duplicate line in Visual Studio Code

5

3 Answers

Here is your solution for your problem

Just press the Ctrl + C without selection it'll copy entire line and you can past it wherever you wanted,

Please read below solution for the query you ask in your question's comment

Stackoverflow don't have the close option but you can delete the question from you profile or you can follow the explaination to mark your question closed from the below link:

How to Closed Questions on StackOverflow?

3

Another alternative to the accepted answer that I often use is SHIFTALTDOWN which duplicates the current line to the line below (likewise, SHIFTALTUP duplicates to the line above). Once you get the copy of your line you can use ALTUP/ALTDOWN to move it wherever you want. This works well if you are wanting a copy of the line in the near vicinity of the current line.

1

Go to File ==> Preferences ==> Keyboard Shortcuts, and update the copy line shortcut entry with any combination you like.for example Ctrl + DownArrow is good for me.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest