views:

135

answers:

4

I want to delete a line just like hitting ctrl+x without anything selected, but without saving the line to the copy stack. Is this possible?

This is using Visual Studio 2010.

A: 

Shift+Delete will completely delete the line that the cursor is on. No clipboard, nothing. It is of course undoable.

KeithS
That's also cut, it seems.
Igor Zevaka
+6  A: 

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

griegs
Perfect, exactly what I was looking for.
JChristian
Yeah but it's less than useful. I'd be mapping Delete + Shift or Ctrl to do the same rather then having to press three keys.
griegs
I personally have this set as Ctrl + E to make it easier to use.
musicfreak
Ctrl + E? I'd be more inclined to keep the xcv and make it shift + x just thinking about it.
griegs
@griegs: Shift + X? Then how do you make a capital X?
musicfreak
LOL, Oh yeah, oops. Never liked captial x anyway!
griegs
+6  A: 

Edit.LineDelete is the name of the command. By default it's bound to CTRL-SHIFT-L, but you can give it whatever you like in Tools | Options | Keyboard.

Edit: Corrected default shortcut info.

Kirk Woll
LineDelete! Why did they have to name it backwards! It looks like in VS2010 it is bound by default to `Ctrl + Shift + L`, though.
JChristian
@JChristian: You could have just searched for "line" or "delete" and gotten to it. :)
musicfreak
@musicfreak, when I first sought this command, I typed "Line.Delete" and looked for what was there (this command is omitted when you search in that fashion). The *terrible* UI only allows me to see 4 results at a time (for me, contrary to that screen shot in the other answer.) which makes it a real pain.
Kirk Woll
@musicfreak, I did search for "line" and "delete". But with so many results returned from those searches, it makes it very difficult to locate.
JChristian
@JChristian: Fair enough. :) They definitely could've made that interface a lot more user-friendly.
musicfreak
Ctrl + L works also to delete a line
nathan_hc
@nathan_hc, that actually performs a **cut**, which pollutes the clipboard. (Try it yourself and paste after using CTRL-L)
Kirk Woll
oh... did not check the clipboard, thanks for the correction
nathan_hc
+1  A: 

I mapped Ctrl+L (Global) to Edit.LineDelete. Otherwise, the shortcut key is Ctrl+Shift+L, which is ackward. Go to Tools > Options > Keyboard as shown below.

Tools | Options | Keyboard

AMissico