Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

There is the shortcut Shift Del to delete a line, but I want to delete without modifying what is in the clipboard.

Is there some way to configure it or another shortcut?

share|improve this question
    
Which version of Visual Studio are you using? Because Del on highlighted lines works for Visual Studio 2008. I wouldn't have posted my answer if I hadn't tested it first. –  ChrisF Sep 29 '10 at 12:57
    
Also what keyboard mapping scheme are you using? –  ChrisF Sep 29 '10 at 13:06
1  
My guess is he's looking for a shortcut for deleting current line without highlighting it. Just a note - Shit+Del is not shortcut for delete, it's actually shortcut for Cut, same as Ctrl+X, hence the changed clipboard. In most programs you need to select a line to do that but in Visual Studio if nothing is selected it will cut the current line. –  T. Kaltnekar Sep 29 '10 at 13:10
1  
@T. Kaltnekar - he should have explained that in the question or as a comment on the answer, we're not all mind readers! –  ChrisF Sep 29 '10 at 13:12
1  
Well, he did state he's looking for a shortcut which would suggest a key combination. I usually just go to start of line, pres Shift+Down then Del. Didn't even know there's a combo for directly deleting a line. For most simple things I don't use special shortcuts since they usually work in one editor and not in another. –  T. Kaltnekar Sep 29 '10 at 13:18

7 Answers 7

up vote 38 down vote accepted

By default, if you are using the C# default profile, you can delete a line using Ctrl + Shift + L.

You can customize this using Tools->Customize. Select "Keyboard". Look for the command Edit.LineDelete to assign it to whichever keyboard shortcut you like.

share|improve this answer
1  
+1 for pointing out where you can find a key combo or add new one. –  T. Kaltnekar Sep 29 '10 at 13:20

Or, the old fashioned way (for me it is a habit and I even had to think what was the combination :) ):

  1. Go to the line you want to delete
  2. Press 'Home'
  3. Then 'Shift' + 'End'
  4. Then 'Del'
  5. and again 'Del'

Works in most text editors :)

share|improve this answer
2  
Not what I asked. –  BrunoLM Sep 29 '10 at 13:23
    
Yes, of course this works. But it is too slow! :) –  Mike Clark May 4 '11 at 16:38
    
Same thing, but one key less: go to line, Home, Shift+Down, Del ;) –  gronostaj Nov 3 '13 at 11:19
    
Old school boy :) –  Samuel Nov 14 '13 at 14:02

The Shortcuts WinForms Control supports the modifier keys, multiple keys shortcuts, and shortcuts without modifier keys to build a keyboard trigger action, such as Ctrl, Alt and Shift with any other keys to trigger a specific action for their Windows applications.

share|improve this answer

You can install the Productivity Power Tools, which are made by Microsoft, as an extension.

The feature that you might get some use out of is Triple Click, which highlights an entire line when you triple click it. Then you can simply use the Delete key.

share|improve this answer

It seems I'm risking a downvote for not providing a single-keystroke solution, but I want to share my solution anyway:

HOME, SHIFT + ARROW-DOWN (repeat for multiple lines), DEL

It's quick and has the added advantage that works in other editors as well.

share|improve this answer
    
I did get down-voted for suggesting this very solution. –  ChrisF Sep 29 '10 at 13:04
2  
My question is not how to delete a line in a text-editor. It is about a shortcut on Visual Studio to delete a line. –  BrunoLM Sep 29 '10 at 13:04
1  
@BrunoLM: my solution works in Visual Studio –  StackedCrooked Sep 29 '10 at 13:15
    
see @T. Kaltnekar's comment on the question –  ChrisF Sep 29 '10 at 13:17
1  
Not what I asked. –  BrunoLM Sep 29 '10 at 13:24

Go to tools -> options. Tab Environment -> subtab Keyboard.

Select Edit.LineDelete. Assign a shortcut. Thats it. I use Alt + D.

share|improve this answer

This combination will only delete the line: Ctrl + Shift + L

Source: http://blogs.msdn.com/b/zainnab/archive/2010/04/04/cut-or-delete-the-current-line-vstipedit0038.aspx

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.