Posted in

Visual Studio 提示:使用 Ctrl-L 删除行,有无剪贴板支持_AI阅读总结 — 包阅AI

包阅导读总结

1. `Visual Studio`、`Clipboard`、`Delete Line`、`Shortcuts`、`Productivity`

2. 本文介绍了关于 Visual Studio 的操作技巧,包括利用 Ctrl-L 带或不带剪贴板备份删除行,还提及了 Windows 剪贴板历史功能的启用及使用,以及这些操作对开发者日常工作效率的提升。

3.

– 介绍 Visual Studio 技巧:同事 Gwyn Peña-Siguenza 分享的使用 Ctrl-L 删行技巧,用此操作删行时会保存至剪贴板,若不想保存可使用 Ctrl-Shift-L。

– 详细步骤:常规删行操作步骤繁琐,而使用 Ctrl-L 简便且能存至剪贴板,按 Win-V 可查看。

– Windows 剪贴板历史:是 Windows 10 引入的实用功能,启用方法为在 Windows 设置中搜索并开启“剪贴板历史”。

– 测试方法:多次复制文本,按 Win-V 查看复制记录,此功能甚至支持图像。

– 更多提示:想了解更多 Visual Studio 快捷键可观看相关视频。

思维导图:

文章地址: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

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.