views:

241

answers:

5

Which shortcut deletes the whole line where cursor is?

+4  A: 

For VS, Shift + Del deletes the entire line the cursor's on.

Jay Riggs
`Shift + Del` is the same as `Ctrl + X`, it's just the cut command. If you have no selection, Visual Studio will cut the entire line. However, if you _do_ have a selection, it will just cut the selection. Gabe's `Ctrl + L` seems like the command that is designed for this scenario...
bdukes
A: 

I don't think there's a pre-defined shortcut to do this in one operation, although you could create a macro. For VS2008 text editing shortcuts see:

http://msdn.microsoft.com/en-us/library/729s2dhh.aspx

Stu Mackellar
+3  A: 

Ctrl+L is a VS shortcut that will delete the current line and copy it to the clipboard.

The Archives of Sara Ford's blog is a goldmine for VS tips.

Gabe Moothart
A: 

Ctrl + Shift + L

Enjoy it!!!

Jorge
A: 

The keyboard shortcut to delete a line without copying the contents has eluded me far to long... There are a few answers here, but they need some clarification:

Ctrl+Shift+L

  • Deletes the current line and does not copy the text (does not matter if anything is highlighted or not).

Ctrl+L

  • Cuts the current line and copies it to your clipboard (does not matter if anything is highlighted or not). This would be the same thing as highlighting the entire line and then using Ctrl+X.

Shift+Delete

  • If nothing is highlighted, then cuts the current line and copies it to your clipboard.
  • If anything is highlighted, then cuts the highlighted text and copies it to your clipboard.


HTH's someone.

Metro Smurf

related questions