Visual Studio for Mac:通过键绑定控制您的IDE

第一次运行 (First Run)

New users to Visual Studio for Mac will notice right away that the IDE offers support for many different key mappings. The first time Visual Studio for Mac is launched on a computer, you will receive a prompt directing you to pick your favorite key mapping.

Visual Studio for Mac的新用户将立即注意到,IDE提供了对许多不同键映射的支持。 首次在计算机上启动Visual Studio for Mac时,您将收到提示,提示您选择喜欢的键映射。

Here, you can select from four different key mappings to help you be as productive as possible from the first line of code you write. But what if you want even more customizations? Well, Visual Studio for Mac has you covered there as well!

在这里,您可以从四个不同的键映射中进行选择,以帮助您从编写的第一行代码中获得最大的生产力。 但是,如果您想进行更多自定义怎么办? 好吧,Visual Studio for Mac也涵盖了其中!

更多定制 (More Customizing)

While setting a default keymap is certainly handy, it doesn’t solve all circumstances. There may be custom mappings that you’ve used in other IDEs, or specific commands that are outside the bounds of the array of preconfigured options. With the Key Bindings selection window, you can map every possible command within the IDE to a specific key. To see the Key Binding options, select Visual Studio > Preferences > Environment > Key Bindings.

虽然设置默认键盘映射当然很方便,但并不能解决所有情况。 可能是您在其他IDE中使用过的自定义映射,或者是预先配置的选项范围之外的特定命令。 使用“键绑定”选择窗口,可以将IDE中的每个可能的命令映射到特定的键。 要查看“键绑定”选项,请选择“ Visual Studio”>“首选项”>“环境”>“键绑定”。

There are several features that I want to point out in this window, and I will take you through them one by one. The most immediate option you see is that there is a dropdown available for various «Schemes» which map to the options that new users see when they first install the IDE. Here you can select from many different pre-packaged key bindings, such as Visual Studio, VS Code and Xcode.

我想在此窗口中指出几个功能,我将逐一介绍这些功能。 您所看到的最直接的选择是,对于各种“方案”都有一个下拉列表,该下拉菜单映射到新用户首次安装IDE时看到的选项。 在这里,您可以从许多不同的预打包键绑定中进行选择,例如Visual Studio,VS Code和Xcode。

But what if you want even more control? What if you really, really want «Find Derived Symbols» to be mapped to Control-Option-D? Setting custom keybindings is super easy in Visual Studio for Mac. To get started, you can either scroll through the list of available commands, or search for the command in the search box. The list of available commands is organized by type of command and can be collapsed for easier navigation. Once you find the command you would like to map, you can select it and then type the desired key binding in «Edit Binding» followed by clicking «Apply». In the below GIF, I set the binding for «New Breakpoint» to Control-Shift-B.

但是,如果您想要更多的控制权怎么办? 如果您确实确实希望将“查找衍生符号”映射到Control-Option-D,该怎么办? 在Mac的Visual Studio中,设置自定义键绑定非常容易。 首先,您可以滚动浏览可用命令列表,也可以在搜索框中搜索该命令。 可用命令列表按命令类型进行组织,可以折叠以方便导航。 找到要映射的命令后,可以选择它,然后在“编辑绑定”中键入所需的键绑定,然后单击“应用”。 在下面的GIF中,我将“ New Breakpoint”的绑定设置为Control-Shift-B。

You can also edit an existing breakpoint in a very similar manner. In the below GIF, you can see how to edit the «New File» command to map to Control-Shift-N from the default Command-N. You’ll notice that all I need to do is type in the command I prefer and click apply. If you want to add multiple bindings, simply click «Add» instead of «Apply».

您也可以以非常相似的方式编辑现有断点。 在下面的GIF中,您可以看到如何编辑“新文件”命令以从默认Command-N映射到Control-Shift-N。 您会注意到,我需要做的就是输入我喜欢的命令,然后单击Apply。 如果要添加多个绑定,只需单击“添加”而不是“应用”。

Finally, with so many commands to remember, it can sometimes be hard to keep track and avoid duplicates. To ensure that each key binding is unique, Visual Studio for Mac checks against all configured commands and warns you of a duplicate if one is detected. It will also check for command duplication, so you can either replace the original or your newly created binding. The GIF below shows what happens when mapping the «New Breakpoint» command to the «Command-C» keyboard binding which conflicts with «Copy».

最后,由于要记住的命令太多,有时可能很难保持跟踪并避免重复。 为确保每个键绑定都是唯一的,Visual Studio for Mac将检查所有已配置的命令,并在检测到一个命令时警告您重复。 它还将检查命令是否重复,因此您可以替换原始绑定或新创建的绑定。 下面的GIF显示将«New Breakpoint»命令映射到与«Copy»冲突的«Command-C»键盘绑定时发生的情况。

Now that you know how to edit the key mappings in any way you see fit, you can fully customize the IDE and get to writing code the way you love! If you want to see more key binding information, please check out our Toolbox video on the subject on Channel 9

既然您知道如何以自己认为合适的方式编辑键映射,则可以完全自定义IDE并以自己喜欢的方式编写代码! 如果您想查看更多按键绑定信息,请在第9频道上查看有关该主题的工具箱视频

If you have any feedback or suggestions, please leave them in the comments below. You can also reach out to us on Twitter at @VisualStudioMac. For any issues that you run into when using Visual Studio for Mac, please Report a Problem.

如果您有任何反馈或建议,请留在下面的评论中。 您也可以通过@VisualStudioMac在Twitter上与我们联系 。 对于在使用Visual Studio for Mac时遇到的任何问题,请报告问题

翻译自: https://habr.com/en/company/microsoft/blog/482386/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值