Whosdatdev
Whosdatdev

Reputation: 341

Visual studio clear line

I want to clear the current selected line in visual studio (with a hotkey). I know that Ctrl + (Shift +) L removes the the current line, but that's not what I want. Example of how I want it to work:

BEFORE

AFTER

I was only able to find hotkeys that remove the selected line and place the cursor on the previous or next line. Yes, I could just remove the line and create a new one, but I'd prefer to use a single hotkey (vs or resharper)

Upvotes: 1

Views: 146

Answers (1)

Sergey Vlasov
Sergey Vlasov

Reputation: 27880

You can create the following C# command with my Visual Commander extension and assign a shortcut to it:

public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package) 
{
    DTE.ExecuteCommand("Edit.LineStart");
    DTE.ExecuteCommand("Edit.LineEndExtend");
    DTE.ExecuteCommand("Edit.Delete");
}

Upvotes: 1

Related Questions