Re: VS2008: Problem with restoring keybindings


In my configuration restoring the keybindings does not work.

No matter whether I press "Restore" in the keyboard manager or disable
ViEmu the original VS's keybindings are lost.

The configuration is:
  ViEmu 2.2.8
  Visual Studio 2008 Standard, SP 1, German, Keyboard layout: Visual C++ 6
  Windows XP

The keyboard manager shows the following information:
Saved keybindings are:

Edit.ViewWhiteSpace=Text-Editor::Strg+R, Strg+W||Global::Strg+Umschalt+8
Edit.ToggleWordWrap=Text-Editor::Strg+E, Strg+W
Refactor.Rename=Global::Strg+R, Strg+R
Refactor.ExtractMethod=Global::Strg+R, Strg+M

No clashing keybindings

Scanned keys:

yes: Restore/remove saved keybindings when disabling/enabling ViEmu
yes: Scan for clashing keybindgs on startup

But the following works:
Imagine I want to enable the <ctrl-V> of Vim (blockwise selection) and
the <ctrl-F> of Visual Studio (Find). Then I have to do:

- Set the scanning keys in ViEmu's keyboard manager:
  RBDUWTQEYOINP]V    (F removed and V added compared to the default)

- Reload VS's original keybindings via Extras->Options->Environment-Keyboard...
  and enter ViEmu's keyboard manager. Then the manager shows the
  correct clashing keybindings.
- After pressing "Save and remove" and returning to the code view
   <ctrl-F> and <ctrl-V> work as expected.

But after this neither pressing "Restore" in ViEmu's keyboard manager
nor disabling ViEmu brings back the original VS keybindings.

Any idea what is going wrong here?



Re: VS2008: Problem with restoring keybindings


(It's a weird nickname to respond to).

Restore is used to re-assign the keybindings on the left-hand-side list. This same restoring is done temporarily when ViEmu is disabled (Ctrl-Shift-Alt-V), and they are re-removed after enabling ViEmu again (same keypress). Can you check whether all keybindings are fixed when you use Ctrl-Shift-Alt-V?

I'm suspecting that it may be related to using the German-localized version of Visual Studio. I don't have access to it, and there are a couple differences (the "Strg" prefix instead of "Ctrl", and the scope "Text-Editor", which in the US version is "Text Editor" (duh)). Maybe something is not accounted for. Let me know whether Ctrl-Shift-Alt-V restoring/removing works, and after that, I think we can try to work out what the reason is (the keybindings API that ViEmu uses is also available to VS macros).


  -- Jon


Re: VS2008: Problem with restoring keybindings

Hi Jon,

Thank you again for the response.

Well, if I disable ViEmu using Ctrl-Shift-Alt-V none of the saved keybindings are restored.
E.g., if ViEmu is disabled ctrl-n should open a dialog to create a new file. But nothing happens
if I press ctrl-n.

Options->Environment->Keyboard shows that the command "Datei.NeueDatei" (German for
File.NewFile) is not bound to any key.
Same holds true for ctrl-o (open file), ctrl-p (print) - I have not tested the other clashes yet...

After enabling ViEmu via Ctrl-Shift-Alt-V the keybindings work as expected for vim.


Last edited by LoveVim (2009-06-27 23:31:22)


Re: VS2008: Problem with restoring keybindings


Can you go to the macros IDE and try whether the following code works to set Ctrl-F as the binding to Edit|Copy?

    Sub test1()
        DTE.Commands.Item("Edit.Copy").Bindings = "Global::Ctrl+F"
    End Sub

You need to use Tools|Macros IDE, paste the code above in a module (I could only make it work in the Utilities module under Samples, don't know why), and press F5 to run it.

PS: Use the German name of the command, ViEmu uses the local name when setting keybindings.


Re: VS2008: Problem with restoring keybindings

Hello Jon,

I have added this to Samples->Utilities below Public Module Utilities:

Sub test1()
        DTE.Commands.Item("Bearbeiten.Kopieren").Bindings = "Global::Ctrl+F"
End Sub

After running this macro Ctrl+f has been assigned to Edit.Copy.
Extras->Options->Environment->Keyboard   Edit.Copy shows Ctrl-F as key binding.

When pressing ctrl-f the selected text is copied into clipboard.

The key scan code is:
RBDUWTQEYONP]V,  I have removed F and added V.



Re: VS2008: Problem with restoring keybindings


Jon wrote:

I have been trying (for a few hours now!) to devise a test, using just the macros IDE, to see why keybinding setting doesn't work in the German version of VS. I'm stumbling into a block because even MSDN examples don't work. Can I say, again, how much I hate VS's VB-based programmability environment, and the clunkiness of their object model?

I feel with you.  Don't waste too much time to fix this. I can live with this bug.



Re: VS2008: Problem with restoring keybindings

Thanks LoveVim. I'm sorry the system does not work fine with the German localized version of VS. I will revisit this issue once the new input-handling system is in place, as more than one thing could be different.


  -- Jon