Posts [ 11 ]

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

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.

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:

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!

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.

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.