Visual Studio 2008:在 Emacs 和默认键绑定之间平滑切换

发布于 2024-09-06 09:13:47 字数 96 浏览 3 评论 0原文

Visual Studio 2008 中有什么方法可以在使用 Emacs 键绑定和默认键绑定之间平滑切换吗?我很快就会进行一些结对编程,我需要 Emacs 键绑定来防止自己发疯。

Is there any way in Visual Studio 2008 to smoothly switch between using Emacs keybindings and the default ones? I will soon be doing some pair programming and I need my Emacs keybindings to keep myself from going insane.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

羞稚 2024-09-13 09:13:47

创建一个新的 VS 宏并添加以下代码:

Sub ToggleEmacsKeyBindings()

    Dim emacsSchemeName As String = "Emacs"
    Dim defaultSchemeName As String = "(Default)"

    Dim props As EnvDTE.Properties = DTE.Properties("Environment", "Keyboard")
    Dim propsItem As EnvDTE.Property = props.Item("SchemeName")

    Dim previousScheme As String = propsItem.Value

    If propsItem.Value = emacsSchemeName Then
        propsItem.Value = defaultSchemeName
    ElseIf propsItem.Value = defaultSchemeName Then
        propsItem.Value = emacsSchemeName
    End If

    MsgBox("Previous Scheme: " + previousScheme + Environment.NewLine + Environment.NewLine + "New Scheme: " + propsItem.Value)

End Sub

然后,您可以为此宏指定键盘快捷键 更快速、更轻松地在 Emacs'Default' 键盘方案之间切换。

(注意:这适用于 VS 2005,尚未在 VS 2008 中进行测试,但它应该也适用。它也适用于 VS 2010 和 已安装 Emacs 模拟扩展。)

Create a new VS macro and add this code :

Sub ToggleEmacsKeyBindings()

    Dim emacsSchemeName As String = "Emacs"
    Dim defaultSchemeName As String = "(Default)"

    Dim props As EnvDTE.Properties = DTE.Properties("Environment", "Keyboard")
    Dim propsItem As EnvDTE.Property = props.Item("SchemeName")

    Dim previousScheme As String = propsItem.Value

    If propsItem.Value = emacsSchemeName Then
        propsItem.Value = defaultSchemeName
    ElseIf propsItem.Value = defaultSchemeName Then
        propsItem.Value = emacsSchemeName
    End If

    MsgBox("Previous Scheme: " + previousScheme + Environment.NewLine + Environment.NewLine + "New Scheme: " + propsItem.Value)

End Sub

You can then assign a keyboard shortcut to this macro to more quickly and easily toggle between Emacs and 'Default' keyboard scheme.

(Note: This works in VS 2005 and have not tested in VS 2008 but it should work too. It also works in VS 2010 with the Emacs emulation extension installed.)

你在我安 2024-09-13 09:13:47

VisEmacs 允许您在 Visual Studio 中使用 Emacs 编辑文件。因此您根本不必切换键绑定!有关 VisEmacs 的一些更有用的信息位于此处

VisEmacs lets you edit files using Emacs, from within Visual Studio. So you don't have to switch keybindings at all! Some more useful information on VisEmacs is here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文