Visual Studio 2008: Smoothly switch between Emacs and default keybindings

假装没事ソ 提交于 2019-12-11 02:04:57

问题


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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/3082836/visual-studio-2008-smoothly-switch-between-emacs-and-default-keybindings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!