Disabling a single-line copy in Visual Studio

Is there a way to disable the rather annoying function that Visual Studio (2008 in my case) has to copy a line (with text on it), the cursor is turned on when the CTRL - C button is pressed, and there is no choice made?

I know how to disable copying blank lines. But it drives me crazy.

ETA: I don't want to customize the keyboard shortcut.

ETA-II: I'm NOT looking for "Tools-> Options-> Text Editor-> All Languages-> Apply Cut or Copy to Blank Lines ...".

+33
visual-studio-2008 visual-studio keyboard-shortcuts
Sep 20 '08 at 13:05
source share
7 answers

If you do not want to adjust the keyboard settings, then Ctrl + C will always be Edit.Copy, which will copy the current line if nothing is selected. If you do not want to use VS tools to customize the interface, you cannot do this.

However, the following works: Assign this macro to Ctrl + C :

Sub CopyOnlyIfSelection() Dim s As String = DTE.ActiveDocument.Selection.Text Dim n As Integer = Len(s) If n > 0 Then DTE.ActiveDocument.Selection.Copy() End If End Sub 
+14
Mar 24 '10 at 16:48
source share

The real problem that you are probably experiencing is that you go to insert with CTRL + V. And you accidentally type CTRL + C , and eventually overwrite the material that is in your clipboard. You cannot disable this, as far as I know, however, the work for this is that you can press CTRL + SHIFT + V several times to return to the stack of things that you copied into the visual studio. This not only allows you to restore what you originally copied, but also find that CTRL + SHIFT + V is very useful in many other situations.

+22
Nov 02 '08 at 1:48
source share

I’m sure the way to do this in 2008 is the same as in 2005 ... check out this tutorial, “Customizing Keyboard Shortcuts,” (about 1/3 of the way down)

http://msdn.microsoft.com/en-us/library/bb245788(VS.80).aspx

+1
Sep 20 '08 at 13:24
source share

I do not think that this can be done without any third-party clip manager that would prevent you from overwriting the contents of the clipboard with an empty string.

+1
Sep 20 '08 at 13:57
source share

I have the free SlickEdit add-on installed, and its CommandSpy function shows that Ctrl + C executes Edit.Copy, whether there is selected text or not. Therefore, I think the answer to your question is No.

However, I remember this feature that annoyed me when I first encountered it; now I rely on it and get annoyed when I try to use the same trick in other programs and nothing happens.

+1
Sep 30 '08 at 9:51
source share

I have the same problem: at first I thought it was bad, I thought I accidentally typed ctrl-c instead of ctrl v, but no, I really have problems with these things.

= /

0
Mar 24
source share

I know this is an old question, but since macros are no longer supported in new versions of Visual Studio, I decided to share my new extension (because I could not find any existing extensions): https://marketplace.visualstudio.com/points ? ITEMNAME = KiwiProductions.CopyOnlySelection

0
Jun 17 '19 at 19:12
source share



All Articles