Visual Studio 2008:平滑地在Emacs和默认键绑定之间切换 [英] Visual Studio 2008: Smoothly switch between Emacs and default keybindings

查看:157
本文介绍了Visual Studio 2008:平滑地在Emacs和默认键绑定之间切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

推荐答案

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

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

然后您可以为这个宏分配一个键盘快捷键,以更快速,轻松地在 Emacs 之间切换'Default'键盘方案。

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

(注意:这个工作在VS 2005中,没有在VS 2008中测试,但它也应该工作。它也可以在VS 2010中使用 Emacs仿真扩展已安装。)

(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.)

这篇关于Visual Studio 2008:平滑地在Emacs和默认键绑定之间切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆