4

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.

Keith Pinson
  • 7,835
  • 7
  • 61
  • 104
rockzombie2
  • 2,835
  • 4
  • 16
  • 20
  • Possible duplicate: [Is it possible to map to : in vim?](http://stackoverflow.com/questions/7652590/is-it-possible-to-map-c-to-in-vim/7653633#7653633) – mMontu Apr 24 '14 at 16:15
  • @nMontu it looks like '-' is being captured when I do it in gVim, but I can't do this same check in vsvim, since it'll just insert `^Q`. Is there another way to check for this? – rockzombie2 Apr 24 '14 at 19:28
  • I think this issue is not related to vsvim in any way. If you have any doubts about, try removing the plugin and create a simple mapping for on your .vimrc. About the check, it is not about capture '-', but about Alt+-. So you should enter insert mode, hit Ctrl-Q (or Ctrl-V -- check that answer for details, but if it is inserting ^Q you probably should use ^V) and then Alt--. I've checked in my gVim and it doesn't sees the Alt--. – mMontu Apr 25 '14 at 10:47
  • The Alt-- mapping works perfectly fine in gVim, and it's in my vimrc. The issue is using this same mapping in vsvim. I tried mapping it in both my vsvimrc and manually mapping it while inside visual studio. Like I said, I can't do the Ctrl-Q or Ctrl-V check in vsvim because Ctrl-Q inserts that `^Q` and Ctrl-V is mapped to paste (even if I change the vsvim settings to let vsvim handle Ctrl-V). – rockzombie2 Apr 25 '14 at 14:11

1 Answers1

3

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.

Keith Pinson
  • 7,835
  • 7
  • 61
  • 104