在Visual Studio中关闭整行复制 [英] Turn Off Whole Line Copy in Visual Studio

查看:125
本文介绍了在Visual Studio中关闭整行复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio 2010中有一项设置,可以在光标位于空白行且没有选择时关闭复制和剪切命令。但是,当光标不在空白行上并按ctrl + C时,它将始终复制整行到剪贴板。我觉得这很烦人,因为我总是先突出显示某些内容,将其复制,然后将光标放在要粘贴的位置,然后按ctrl + V。但是,有时我会错过 v 并点击 c ,它将剪贴板上的文本替换为当前行的文本,因此我必须重新开始。

There is a setting in Visual Studio 2010 to turn off copy and cut commands when the cursor is on a blank line and there is no selection. However, when the cursor is not on a blank line and you press ctrl+C, it always copies the entire line to the clipboard. I find this very irritating because I always highlight something first, copy it, then place the cursor where I want to paste it and press ctrl+V. However, sometimes I miss the v and hit the c, which replaces the text on the clipboard with the text of the current line and I have to start all over...

有没有人知道在没有选择的情况下如何关闭复制,而不管光标是否在空白行上? / p>

Does anyone know how to turn off copying when there is no selection, regardless of whether the cursor is on a blank line or not?

推荐答案

设置中有以下选项:
转到工具-选项->文本编辑器-> ALl语言- >在没有选择的情况下将剪切或复制命令应用于空白行

There is the option in the settings: Go to Tools - Options -> Text Editor -> ALl Languages -> Apply Cut or Copy commands to blank lines when there is no selection

此外,如果不小心将某些内容复制到剪贴板中,则可以使用以下快捷方式:
Ctrl + Shift + V –在剪贴板上循环。

Also if you accidentally copied something into clipboard you can use following shortcut: Ctrl+Shift+V – cycle through the clipboard ring.

已编辑
似乎没有选择,因为默认情况下Ctrl-C被分配给Edit.Copy命令,如果未选择任何内容,它将复制当前行。但是,您可以将以下宏分配给Ctrl-C,它将解决此问题:

EDITED: It seems there is no option to turn of it because by default Ctrl-C is assigned to Edit.Copy command, which copies the current line if nothing is selected. However you can assign following macro to Ctrl-C and it should fix the issue:

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

这篇关于在Visual Studio中关闭整行复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆