Skip to content
| Marketplace
Sign in
Visual Studio>Tools>CopyOnlySelection

CopyOnlySelection

Kiwi Productions

|
234 installs
| (7) | Free
This extension adds two new edit menu items / commands: Copy (Only Selection) [Edit.CopyOnlySelection] & Cut (Only Selection) [Edit.CutOnlySelection]

Are you like me, always fat fingering the 'Ctrl+C' when I'm trying to hit 'Ctrl+V' only to overwrite what I had in the clipboard with whatever line the cursor is on? Are you annoyed by the line copy / cut feature of Visual Studio? This simple extension bypasses that feature.

It won't completely eliminate the problem - if you have text selected you are going to replace, and still hit 'Ctrl+C' by mistake, it will copy the selected text into the clipboard. At least it won't copy the entire line into the clipboard anymore for simply having the cursor on the line when you go to paste.

  1. Install this extension, and then go into Tools -> Options... in Visual Studio.
  2. Navigate to the Enviroment -> Keyboard category, and search for the 'Copy' command.
  3. Select the Edit.Copy command from the list of commands, and remove the 'Ctrl+C' binding.
  4. Select the Edit.CopyOnlySelection from the list of commands, and add the 'Ctrl+C' binding.
  5. Repeat for the Cut command if desired.

No more accidental Ctrl+C replacing your clipboard content when hitting Ctrl+V (as long as you have no text selected).

This extension checks to see if the Active Window is a Document Window, and if the document text selection is empty or not. If it is empty, then the copy command is aborted.

If the active window is not a document window, or the text selection is not empty, the traditional Edit.Copy command is called. This allows, such things as copying a file in the Solution Explorer, or copying a control in the WinForms designer to continue to work with the 'Ctrl+C' binding.

Basically the entire purpose of this extension is to bypass the single line copy / cut feature Visual Studio added, but didn't allow the end user to disable.

Changes from 1.2 to 1.3:

  • Changed the graphics from the default starting graphics to new graphics.
  • Trying to Execute the Edit.Copy/Cut commands when the Project Properties window had focus was throwing an exception. If Edit.Copy/Cut command fails to execute, the code now gets the bindings for the Edit.Copy/Cut, and then uses SendKeys to simulate clicking those keys. For instance, the Edit.Copy command is by default bound to Ctrl+C AND Ctrl+Ins. So if you remove Ctrl+C as a binding, but leave Ctrl+Ins intact, this extension will hit the keyboard keys of Ctrl+Ins if Edit.Copy fails.
  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft