Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cut line shortcut in Visual Studio Code (Ctrl+L in VS) (not delete line!)

Visual Studio has by default the shortcut Ctrl+l (cut line). It copies the line where the cursor is to the clipboard and deletes it.

I cannot find it in Visual Studio Code. Is there a way to add it as end user?

(I know there is Ctrl+Shift+K for delete line, which is not the same)

like image 369
Alexander Mihailov Avatar asked May 16 '18 09:05

Alexander Mihailov


People also ask

How do you cut a line in VS Code?

Shift + Delete on VS Code cuts the line i.e. copies the line to the clipboard and deletes it.

What is Ctrl Shift L in VS Code?

Press Ctrl + Shift + L . This will select all words that match your current selection. It also adds a cursor to each text span matching your current selection. Simply start typing your replacement text and vscode will start replacing all instances of text matching your selection in-editor as you type.

How do you delete one line in VS Code?

Ctrl + Shift + L will delete the line and not copy to the clipboard.

What is L Ctrl?

Align the text to the left. Ctrl+L. Align the text to the right. Ctrl+R.


1 Answers

What you are looking for is the Cut command:

editor.action.clipboardCutAction 

It cuts (copies to the clipboard then deletes the line) either a selection or the entire line if nothing is selected.
I tested it with vscode 1.23.1

On windows this command is bound to Ctrl + X as well as to Shift + Delete by default.

Command works this way when Editor: Empty Selection Clipboard preference is enabled. It is enabled by default:

"editor.emptySelectionClipboard": true 
like image 138
HaaLeo Avatar answered Sep 29 '22 20:09

HaaLeo