Posted in

Visual Studio Code 1.92 改善了调试体验_AI阅读总结 — 包阅AI

包阅导读总结

1. 关键词:Visual Studio、Ctrl-L、Clipboard backup、Delete line、Shortcuts

2. 总结:本文介绍了 Visual Studio 中使用 Ctrl-L 及 Ctrl-Shift-L 分别带或不带剪贴板备份删除行的操作,还提及了 Windows 剪贴板历史的启用和使用,以及更多关于 Visual Studio 的快捷键提示。

3. 主要内容:

– Visual Studio 操作技巧

– 使用 Ctrl-L 可删除一行并备份到剪贴板

– 使用 Ctrl-Shift-L 可删除一行且不备份到剪贴板

– Windows 剪贴板历史

– 在 Windows 10 引入,可在设置中启用

– 按 Ctrl-C 多次复制,按 Win-V 可查看复制历史,支持图像

– 更多提示

– 可在 Visual Studio YouTube 频道观看相关视频获取更多快捷键信息

思维导图:

文章地址:https://devblogs.microsoft.com/visualstudio/visual-studio-tip-deleting-a-line/

文章来源:devblogs.microsoft.com

作者:Laurent Bugnion

发布时间:2024/7/24 7:00

语言:英文

总字数:590字

预计阅读时间:3分钟

评分:88分

标签:Visual Studio,生产力技巧,代码编辑,微软


以下为原文内容

本内容来源于用户推荐转载,旨在分享知识与观点,如有侵权请联系删除 联系邮箱 media@ilingban.com

Visual Studio tip: Using Ctrl-L to delete a line with and without Clipboard backup

Here is one Visual Studio tip from my colleague Gwyn Peña-Siguenza which I didn’t know about! Yes, even after 26 years using this fantastic tool, I am still discovering new features. So thanks to Gwyn for this!! This is all about deleting lines, and using the Windows Clipboard for support.

You can see the short video on our YouTube channel, and there is also a longer video with 20 must-know shortcuts here. Don’t forget to subscribe if you want to learn more tips!

Using the Clipboard History in Windows

One of my favorite tools on Windows is the Clipboard History. This feature was introduced in Windows 10 and is seriously adding productivity to my day-to-day. If you haven’t been using it, you need to enable it in the Windows settings. Simply follow the steps:

  • Go to the Windows Settings
  • Search for Clipboard settings
  • Enable “Clipboard History”

Image 2024 07 23 13 37 20
Windows Clipboard settings

To test that this works, try the following:

  • Copy one piece of text using Ctrl-C
  • Copy another piece of text using Ctrl-C again.
  • Press the Windows key and the V key together (Win-V)
  • This brings up a new window where you should be able to see the two entries you just copied at the top.

This enables you to copy multiple pieces of content in a document without having to always Ctrl-Tab back and forth between the original document and the target document. And the cool thing is that it even supports images!

Image 2024 07 23 13 44 48
Windows Clipboard history with two items of text and one image

Deleting a line with clipboard support

So why am I bringing this up? Well another thing that we do quite often in code is deleting lines. There’s even a joke that the best developers are not the one writing a lot of lines of code, but those whodelete a lot of lines of code 🙂

In order to delete a whole line, most people would follow these steps:

  • Place the cursor on a line of code.
  • Move the cursor to the top of the line with the Home key.
  • If the line was indented, press Home once again to ensure that the cursor is really on column 0.
  • Press the Shift key.
  • With the Shift key pressed, move the cursor at the end of the line with the End key.
  • With the whole line selected, press the Delete button.
  • Probably you will also have to press Delete once more to delete then empty line.

This is a lot of steps for a simple operation that we do a LOT in a developer’s day. Thankfully you can simplify it.

  • Place the cursor on a line of code.
  • Press Ctrl-L.

That’s it. The line is deleted and there is no empty line remaining where it was. but the best part is, this line was saved in the Clipboard! To test this, simply press Win-V and you should see the line you just deleted on top of the history. Of course this also works for multiple lines.

Deleting a line without clipboard support

Now, sometimes you don’t want the deleted line(s) to be saved to the Clipboard history. In this case, follow these steps:

  • Place the cursor on a line of code.
  • Press Ctrl-Shift-L.

This way you can keep your Clipboard history tidy.

More tips about Visual Studio

Hopefully these tips help you to be more productive! And if you want to learn more about key shortcuts in Visual Studio, you should watch Gwyn’s 5:30 minutes video on the Visual Studio YouTube channel.