visual-studiovimremapvsvim

Mapping ALT '-' (dash/minus) in VsVim


I've tried looking for a solution to my problem, but I can't seem to find anything that works. I'm using VsVim, the Vim plugin for Visual Studio. In my _vsvimrc, I have the following remaps:

nnoremap <A-=> <C-a>
nnoremap <A--> <C-x>

The ALT+= remap works just fine, but the other mapping is where I'm having issues. When I try to use it, I just get an error sound and it doesn't do anything. Looking at :map I can see that it looks like it's mapped. I'm just assuming <lt>A is ALT.

n    <lt>A--> <C-X>
n    ½ <C-A>

So I'm inclined to believe my problem is with the - dash mapping. Is there a different way to map it that I'm not aware of?

Any help would be appreciated.


Solution

  • If you take a look at the "Keymap issues with Alt" VsVim issue on GitHub, you will see that (as of this writing) VsVim does not support mappings with ALT in them. (Are you sure your ALT-= binding is working? I tried it with no success.) Apparently it is non-trivial to capture these keys in Visual Studio. Jared commented on that issue:

    Spent some time talking with the owners of keyboard routing in Visual Studio. They've assured me there is really no way to intercept the Alt key from an extension. It's possible in some limited scenarios (controlling the IVsWindowPane) but it's not generally a supported feature.

    This really puts me in a corner. I believe I could still fake this behavior by switching VsVim to a package, registering DTE.Command objects which are bound to Alt and intercepting them that way. This is a rather large change though.

    That is an old comment, and since then, he has switched VsVim to be a full package. However, it seems that he has not fixed the Alt issue as of this writing.