Is there a way to delete a line in Visual Studio without cutting it?

和自甴很熟 提交于 2019-12-03 06:09:56

问题


I want to delete a line just like hitting Ctrl + X without anything selected, but without saving the line to the copy stack. Is this possible?

I'm using Visual Studio 2010.


回答1:


Edit.LineDelete is the name of the command. By default it's bound to Ctrl + Shift + L, but you can give it whatever you like in Tools | Options | Keyboard.

Edit: Corrected default shortcut info.




回答2:


Ctrl + Shift + L will delete the line and not copy to the clipboard.




回答3:


I mapped Ctrl + L (Global) to Edit.LineDelete. Otherwise, the shortcut key is Ctrl + Shift + L, which is awkward. Go to Tools > Options > Environment > Keyboard as shown below.




回答4:


Correction in my answer

Ubuntu 16 & Visual studio Version: 1.30.1

To cut line Shift + del

To delete line Shift + Ctrl + k




回答5:


Its Cmd + Shift + K on mac by default.

But it can be modified according to user needs from the settings (Preferences -> Keyboard Shortcuts) -> search for Delete Line key value.




回答6:


All the answers were helpful but didn't seem to work for me.

So I found the solution --> for Visual Studio 2017 (and certainly 2019):

Tools > Options > Environment > Keyboard > on the right pane select Edit.LineEdit.

Below there is a ComboBox Use new shortcut in: with Global written --> Change it to Text Editor.

On the right there is a Text input Press shortcut keys:, so use the shortcut of your choice.

Then click on Assign PushButton on the right (otherwise it won't be applied).

Finally > OK.

You can now open a .CPP file and use your shortcut to remove a line.




回答7:


On Visual Studio 2019 for Mac, it's CTRL + K to cut the whole line by default.



来源:https://stackoverflow.com/questions/3731968/is-there-a-way-to-delete-a-line-in-visual-studio-without-cutting-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!