创建 Visual Studio 快捷键
我在新项目中做了很多事情,例如,输入对 Google AJAX API 的简单调用以包含 jQuery。我可以以某种方式在 VS 中映射我自己的快捷方式组合,让它在我输入快捷方式时插入吗?
There are some things that I do a lot in a new project, for example, entering in a simple call to the Google AJAX API to include jQuery. Can I somehow map my own shortcut combo in VS to have it insert this is when I enter my shortcut?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1)您必须创建一个宏,将当前文本插入光标所在的位置。例如,要为突出显示的文本插入时间戳(如 Migratordotnet),我在 MyMacros 项目中有此宏:
2) 转到“工具”->“选项->环境/键盘 ->在“显示包含以下内容的命令”选项中突出显示您的宏 ->在“按快捷键”框中输入要与宏关联的组合键/和弦。至于“使用新的快捷方式:”部分,全局选项将应用于 Visual Studio 中的每个文档类型,无论焦点在哪里。因此,对于上面的示例,可以在
Macros.MyMacros.Tools.DateTimeStamp
中找到该命令。1) You would have to create a Macro that inserts the current text where the cursor is. For example, to insert a timestamp for the highlighted text (like for Migratordotnet) I have this macro in the MyMacros project:
2) Go to Tools -> Options -> Environment/Keyboard -> Highlight your Macro in the "Show commands containing:" selection -> in the "Press shortcut keys" box do the key combination/chord you want to associate to the macro. As for the "Use new shorcut in:" section, the Global option will apply to every document type in Visual Studio, no matter where the focus is. So for my example above, the command is found at
Macros.MyMacros.Tools.DateTimeStamp
.