Is there any shortcut to select the current line in Visual Studio?

孤街醉人 提交于 2019-12-03 00:59:01
Mitch Wheat

If you want to copy a line, simply place cursor somewhere in that line and hit CTRL+C

To cut an entire line CTRL+X

@Sean found what I was looking for:

To disable this default behavior remove the checkmark (or check to re-enable)

Apply cut or copy commands to blank lines when there is no selection

Accessed from the menu bar: Tools | Options | Text Editor | All languages

You can also enter copy into the options search box for quicker access

[Tested in VS2008, 2010, 2017]

Clicking the line 3 times does the trick

If you have ReSharper you could use

Ctrl + W - Extend Selection

Sidenote: You may have to use it multiple times depending on the context of your present text cursor position.

If you want to select a line or lines you can use the combination of ctrl + E then U. This combination also works for uncommenting a complete line or lines. This combination looks somewhat strange to work with, but it will get habituated very soon :)

You can also use Ctrl + X to cut an entire line. Similarly, you can use Ctrl + C to copy an entire line. As long as you don't have anything selected, these commands will work on the entire line.

  • Clicking anywhere on the line and (CRTL + C) will copy entire line.
  • Clicking three time in quick succession also selects entire line.

If you click once on the row number the entire row will be selected.

There is a simple way of doing it, simple use Home or End button to reach the start or end of line, and then use home + shift or end + Shift depending on where your cursor is. Hope it helps.

If you want to select full row Ctrl E + U

You can use CTRL + U . This shortcut is use also for uncomment.

You can change the shortcut on this feature. Go to Tools->Options->Environment->Keyboard->Edit.UncommentSelection and assign CTRL+W (same as Resharper) or you can use what shortcut do you want.

Use the following:

Shift + End If cursor is at beginning of line.

or

Shift + Home If cursor is at the end of the line.

Alternatively, if you use resharper, you can also use the following

Ctrl + w while the cursor is positioned on the line you want to select

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