1

Re: Keyboard Frustration

<disclaimer>
This post is not up to my usual standard of decorum.  I'm too frustrated.
</disclaimer>

I have VS2005 SP1, Resharper 4.1 and ViEmu for VS (legally) installed on three computers.  There also (are/have been) various VS add-ins that also muck with the keyboard installed on one or more of the computers.  The result is the keyboard mappings are different on all three computers.  :(

I would like to set the keyboard meppings one-at-a-time on one computer, and then copy them to the other computers (assuming this is somehow possible).  Questions below.

1. ^F brings up the "Find and Replace" dialog box on one of my computers instead of Going Forward a Screen of Text.  How do I tell VS that ^F should be processed by ViEmu?  I don't see how to do this in section 3.2 of the ViEmu documentation.

2. Is there a tool that can display ALL keyboard bindings?  I have not found any googling.  Something like this (imagine the spreadsheet cells).


              Ctrl                  Alt          Ctrl-Alt            Shift-Ctrl-Alt
   A
   B      Viemu.ScrnBck
   C      Edit::Cut
...
   F      Viemu.ScrnFwd                                       Resharper.SilentCleanupCode
...

3.  Is there a replacement for VS2005-SP1 | Tools | Options / Keyboard?  I can't even find a way to see my current mapping, except by scrolling through all bazillion commands.  One million commands in a four line listbox.  I hate dialog boxes that don't resize intelligently.  This is in the running for "Worst Microsoft Dialogbox Ever" IMHO.

4. Speaking of sucky fixed-size dialog boxes, it would be a whole lot easier to figure out what's going on if I could SEE the entire line in the "Saved keybindings:" and "Current clashing keybindings:" panels on the "ViEmu keyboard management" dialog box.  On this computer there is one Saved keybinding and I can't see it without scrolling.  Below is the Current clashing keybindings, and there only 4 that can be seen without scrolling.

Edit.MakeLowercase=Text Editor::Ctrl+U
Edit.GotoBrace=Text Editor::Ctrl+]
Edit.SelectCurrentWord=Text Editor::Ctrl+W
Edit.ViewWhiteSpace=Text Editor::Ctrl+R, Ctrl+W
Edit.ToggleWordWrap=Text Editor::Ctrl+E, Ctrl+W
Edit.IncrementalSearch=Text Editor::Ctrl+I
Refactor.ExtractMethod=Global::Ctrl+R, Ctrl+M
Refactor.ExtractInterface=Global::Ctrl+R, Ctrl+I
Refactor.PromoteLocalVariable=Global::Ctrl+R, Ctrl+P
Refactor.RemoveParameters=Global::Ctrl+R, Ctrl+V
File.Print=Global::Ctrl+P
Edit.Redo=Global::Ctrl+Y||Global::Shift+Alt+Bkspce||Global::Ctrl+Shift+Z
Edit.Find=Global::Ctrl+F
File.NewFile=Global::Ctrl+N


Thanks.

Last edited by gandalf (2008-10-24 23:32:22)

2

Re: Keyboard Frustration

Hello gandalf,

You are right to complain. There are several issues here conflating to create a horrible user experience. Let's try to address'em as possible.

1) For Ctrl-F (or any other keypress for that matter) to get through to ViEmu, it's necessary that it is *NOT* mapped to any VS keybinding in Tools|Options|Keyboard. This is inherent to VS's architecture, I don't like the design, but that's how it is: VS's main message pump examines keypresses for VS-bindings, and if matching, the keypress is never delivered, but converted to an OLE command. This is why ViEmu removes clashing keybindings the first time it runs (it saves them for dynamic restoring/removal when toggling ViEmu on and off).

So, what you have to do to make Ctrl-F scroll, is to remove its Tools|Options|Keyboard binding(s). If you want to go fancy and make it "come back" when toggling ViEmu off, the process is just a bit more involved (using the ViEmu config dialog). This is described in the docs, let me know and I'll be happy to elaborate more if necessary.

2) There is a VS macro that can be run to list all active keybindings, someone posted it on their blog. Here it is:

-------
Imports EnvDTE
Imports System.Diagnostics

Public Module KeyboardShortcuts

    Sub ListKeyboardShortcuts()
        Dim i As Integer
        Dim j As Integer
        Dim pane As OutputWindowPane = Utilities.GetOutputWindowPane("Commands")
        Dim keys As System.Array

        pane.Clear()
        pane.OutputString("<font face=arial>")
        pane.OutputString("<table border=1 cellspacing=0 cellpadding=2 bgcolor=f0f0ff>" + Chr(10))
        pane.OutputString("<tr><th colspan=2 bgcolor=d0d0e0>Keyboard Mappings</th></tr>" + Chr(10))
        pane.OutputString("<tr><th bgcolor=e0e0f0>Action</th>")
        pane.OutputString("<th bgcolor=e0e0f0>Key</th></tr>" + Chr(10))

        For i = 1 To DTE.Commands.Count
            keys = DTE.Commands.Item(i).Bindings
            If keys.Length > 0 Then
                pane.OutputString("<tr>")

                'DTE.Commands.Item(i).Name() is sometimes blank.
                'We will print an m-dash in this case, as printing a blank table cell is visually
                'misleading, as such a cell has no borders, making it appear to be attached to
                'another cell.
                If DTE.Commands.Item(i).Name() <> "" Then
                    pane.OutputString("<td valign=top>" + DTE.Commands.Item(i).Name())
                Else
                    pane.OutputString("<td><center>&mdash;</center>")
                End If

                pane.OutputString("</td><td>")
                For j = 0 To keys.Length - 1
                    If j > 0 Then
                        pane.OutputString("<br/>")
                    End If
                    pane.OutputString(keys(j))
                Next
                pane.OutputString("</td></tr>" + Chr(10))
            End If
        Next

        pane.OutputString("</table></font>")

    End Sub

End Module
-------

Not as nice as what you show, but it will work. The VS keybinding system is also ugly in some other aspects, with commands without names and the like, but hopefully the output from the above macro will be an improvement.

3) I agree Tools|Options|Keyboard is bad. If you want to see what command a keypress maps too, you can go to the "current keybinding" edit box, press the combination you want to check (annoyingly, it doesn't work for simple keypresses like "Return", "Backspace", etc...), and you will be able to check the commands it's bound to.

4) My own "ViEmu keyboard config" dialog is pretty sucky too. I will make it bigger as a first solution (I'll post back here). The mid- to long-term solution is a better keypress-interception mechanism which won't require removing VS keybindings, this is half-implemented and based on ViEmu/Word&Outlook's mechanism. Hopefully that will make everything simpler and clearer the day it's ready.

Apologies for the horrible user-experience, and let me know if I can help out with anything else!

  -- Jon

3

Re: Keyboard Frustration

Jon -- I was composing a "Thanks for your reply but can you explain..." message when I may have discovered the answer.  On the ViEmu keyboard management dialog box this is the displayed list:

Edit.MakeLowercase=Text Editor::Ctrl+U
Edit.GotoBrace=Text Editor::Ctrl+]
Edit.SelectCurrentWord=Text Editor::Ctrl+W
Edit.ViewWhiteSpace=Text Editor::Ctrl+R, Ctrl+W
Edit.ToggleWordWrap=Text Editor::Ctrl+E, Ctrl+W
Edit.IncrementalSearch=Text Editor::Ctrl+I
Refactor.ExtractMethod=Global::Ctrl+R, Ctrl+M
Refactor.ExtractInterface=Global::Ctrl+R, Ctrl+I
Refactor.PromoteLocalVariable=Global::Ctrl+R, Ctrl+P
Refactor.RemoveParameters=Global::Ctrl+R, Ctrl+V
File.Print=Global::Ctrl+P
Edit.Redo=Global::Ctrl+Y||Global::Shift+Alt+Bkspce||Global::Ctrl+Shift+Z

(Where is the clashing ^F?)

However if I use the arrow keys and go several lines past the last line this is the list:

Edit.MakeLowercase=Text Editor::Ctrl+U
Edit.GotoBrace=Text Editor::Ctrl+]
Edit.SelectCurrentWord=Text Editor::Ctrl+W
Edit.ViewWhiteSpace=Text Editor::Ctrl+R, Ctrl+W
Edit.ToggleWordWrap=Text Editor::Ctrl+E, Ctrl+W
Edit.IncrementalSearch=Text Editor::Ctrl+I
Refactor.ExtractMethod=Global::Ctrl+R, Ctrl+M
Refactor.ExtractInterface=Global::Ctrl+R, Ctrl+I
Refactor.PromoteLocalVariable=Global::Ctrl+R, Ctrl+P
Refactor.RemoveParameters=Global::Ctrl+R, Ctrl+V
File.Print=Global::Ctrl+P
Edit.Redo=Global::Ctrl+Y||Global::Shift+Alt+Bkspce||Global::Ctrl+Shift+Z
Edit.Find=Global::Ctrl+F

That is, there is one more line in the list that's not displayed.  I still don't see the clashing of ^B, which is currently a shortcut for Debug.BreakatFunction.

. . .

I clicked "Save and remove" and this is the Current clashing keybindings:

ReSharper.ReSharper_TypeHierarchy_Browse=Global::Ctrl+E, Ctrl+H
ReSharper.ReSharper_CleanupCode=Global::Ctrl+E, C
ReSharper.ReSharper_ExploreStackTrace=Global::Ctrl+E, Ctrl+T
ReSharper_SilentCleanupCode=Global::Ctrl+E, Ctrl+F
ReSharper.ReSharper_Rename=Global::Ctrl+R, Ctrl+R
ReSharper.ReSharper_Move=Global::Ctrl+R, Ctrl+O
ReSharper.ReSharper_EncapsulateField=Global::Ctrl+R, Ctrl+E
ReSharper.ReSharper_ChangeSignature=Global::Ctrl+R, Ctrl+S

The documentation is unclear to me.  What happens if I click "Save and remove" again?  Are these added to the list of Saved keybindings or do they [b]replace[/] the Saved keybindings?

Thanks.

4

Re: Keyboard Frustration

gandalf wrote:

I still don't see the clashing of ^B, which is currently a shortcut for Debug.BreakatFunction. . . .  I clicked "Save and remove"...

^F and ^B now go forward and backward as expected with ViEmu.  The clashing ^B must have been saved and removed, though I don't see it in Saved keybindings:

Edit.MakeLowercase=Text Editor::Ctrl+U
Edit.GotoBrace=Text Editor::Ctrl+]
Edit.SelectCurrentWord=Text Editor::Ctrl+W
Edit.ViewWhiteSpace=Text Editor::Ctrl+R, Ctrl+W
Edit.ToggleWordWrap=Text Editor::Ctrl+E, Ctrl+W
Edit.IncrementalSearch=Text Editor::Ctrl+I
Refactor.ExtractMethod=Global::Ctrl+R, Ctrl+M
Refactor.ExtractInterface=Global::Ctrl+R, Ctrl+I
Refactor.PromoteLocalVariable=Global::Ctrl+R, Ctrl+P
Refactor.RemoveParameters=Global::Ctrl+R, Ctrl+V
File.Print=Global::Ctrl+P
Edit.Redo=Global::Ctrl+Y||Global::Shift+Alt+Bkspce||Global::Ctrl+Shift+Z
Edit.Find=Global::Ctrl+F

5

Re: Keyboard Frustration

Jon wrote:

2) There is a VS macro that can be run to list all active keybindings, someone posted it on their blog. Here it is:

. . .

        Dim pane As OutputWindowPane = Utilities.GetOutputWindowPane("Commands")

Name 'Utilities' is not declared.

I found some promising code in VS Help for GetOutputWindowPane but this error dlg shows:
Public member 'ToolWindows' on type 'DTEClass' not found. 

When I have nothing else to do maybe it's time to learn Macros...  ;-)

6

Re: Keyboard Frustration

gandalf wrote:

JThe documentation is unclear to me.  What happens if I click "Save and remove" again?  Are these added to the list of Saved keybindings or do they [b]replace[/] the Saved keybindings?

They *replace* the current saved keybindings.  Oh well....   ;-)  Why turn off ViEmu anyway?

7

Re: Keyboard Frustration

admin wrote:

This is why ViEmu removes clashing keybindings the first time it runs (it saves them for dynamic restoring/removal when toggling ViEmu on and off).

As an aside, when my ViEmu trial expired* I noticed that whether or not I tell ViEmu to be disabled or enabled, it still eats keystrokes destined for other plugins, just as if ViEmu were active and in normal mode. If ViEmu disables itself at the end of the trial period it should disable itself. I consider this a bug in ViEmu, to be perfectly honest, though I acknowledge that it would likely be of a low priority given that most users would either uninstall or register at that point. In any case, I just thought I should mention it in case you weren't aware of it.

* I could honestly have used more time than is offered, as the shift to the vim style hit me pretty hard, I must admit, and I've been particularly frustrated by the all-or-nothing nature of ViEmu and the inconsistencies in how it handles selections made by the keyboard when in insert mode versus selections made any other way and/or in any other mode, but I suppose those are topics best saved for another thread. wink

8

Re: Keyboard Frustration

Following from my last post...

Worse yet, uninstalling ViEmu fails to restore the key bindings that it removed. Ugh.

9

Re: Keyboard Frustration

Jeremy,

Apologies for the problems. For one, I will be happy to provide you with an extension for the trial period as long as necessary. Indeed, vi/vim editing is a somewhat "radical" departure from other more commong editing models, and it can be a daunting task to get accustomed.

I will be happy to discuss the issues that you found, VS integration can be quirky at times, but I've tried to implement what made most sense to me as a trade-off between VS and vi/vim-like behavior.

Indeed, the uninstaller doesn't restore the removed keybindings. It's not difficult to restore them, but it's a bit different between VS versions. In VS.NET 2003 and before, it's just a matter of going to Tools|Options|Keyboard, and selecting another keybinding scheme. In VS2005 or later, you need to select one of the keybindings schemes and click "Reset" in that same dialog.

I apologize for the problems again. VS is a quite hostile environment for a vi/vim emulator, it wasn't designed with this kind of extensibility in mind, and this sometimes shows through making the experience less than ideal. I am happy that the tool is solid and well integrated in most major usage patterns, and I always try to provide support to overcome the remaining tough-to-beat obstacles.

Gandalf, I will come back and post about the remaining issues over the weekend, I haven't been able to do so before.

Best regards,

  Jon

10

Re: Keyboard Frustration

admin wrote:

Gandalf, I will come back and post about the remaining issues over the weekend, I haven't been able to do so before.

Jon -- No outstanding issues for me on this thread.  VS keys are set up for ViEmu.  ;-)

11

Re: Keyboard Frustration

Great to hear that gandalf. I'll respond about all the other outstanding issues over the next few days.

Thanks again,

  -- Jon