在 VisualStudio 中禁用空文本的副本

我的手指不知怎么弄错了,这导致了一个非常恼人的情况。

  1. 我选择一个文本块复制;
  2. 我把光标移到我想粘贴代码的地方;
  3. 我不小心又按了 Ctrl + C 而不是 Ctrl + V;
  4. 我复制的文本块被一个空块替换;
  5. 我得回去重新来过。

是否有任何方法禁用此行为,即禁用 VisualStudio2005 + 中文本空块的副本?

6052 次浏览

Press CTRL+SHIFT+V twice.

It's not copying an empty block, it's copying the blank line. You can change this setting in Tools > Options > Text Editor > All Languages > 'Apply Cut or Copy Commands to blank lines when there is no selection'

I'm using Visual Studio 2008 (but I believe this answer applies to Visual Studio 2005).

Select Tools -> Options.

Navigate to the "Text Editor" node and expand it.

Expand "All Languages" (or whatever language you want to apply this to) and check the "Apply Cut or Copy commands to blank lines when there is no selection".

The option that saved my sanity is found in Tools - Options - Text Editor - All Languages - General. There's a checkbox Apply Cut or Copy commands to blank lines when there is no selection. Unchecking this allowed me to hit Ctrl+C all i want on a blank line without losing the content on my clipboard.

Source

Go to Tools > Options > Text Editor > All Languages > General

The option on that page is "Apply Cut or Copy commands to blank lines when there is no selection"

For some reason that option didn't work for me (VS2010)

The answer mentioned here where you assign Ctrl+C to the macro worked however Disabling single line copy in Visual Studio