Saturday, September 3, 2011

Re: Problem mapping Ctrl+Alt combinations in GVIM on windows

On 11:07 Sat 03 Sep , William E. Skeith III wrote:
> On 02/09/11 19:59, William E. Skeith III wrote:
>
>
> > Hello,
> >
> > I am trying to map some basic Ctrl+Alt key combinations for GVIM on windows,
> > for example>
> >      :imap<C-M-L>  <C-Right>
> >
> > but I've become seriously stuck.  It seems that windows GVIM does not respond
> > at all to<C-M-x>, where x is virtually any printable character (0-9,a-z,
> > punctuation, etc.).
> >
> > To test, I hit ctrl-Q while in insert mode, and then ctrl-alt-x key
> > combinations, (as described above) and nothing happens at all.  However, it
> > does respond to other non-printable keys, for example<M-C-Left>, but that's
> > about it.
> >
> > Can anyone else confirm this to be the case?  And if so, are there any
> > work-arounds?  Key combinations like that would be extremely useful for me...
> > By the way, I'm using version 7.3.46, installed just a few days ago.
> >
> > Many thanks in advance for your help.
> >
> > -WES
> >
>
> Ctrl-Alt-letter keys may be preempted by the OS, or they may trigger a menu.
>
> When you type
>     :verbose set wak?
>
> what is the answer?
>
> Oh, and 7.3.046 is already old hat: for W32 I recommend the "Vim without
> Cream" distribution, available as gvim-<version>.exe (a self-installer,
> currently for 7.3.289) at http://sourceforge.net/projects/cream/files/
>
>
> Best regards,
> Tony.
>
> ============================================
> Hi Tony,
>
> Thanks for the quick response!  I had already discovered the issue with menu
> interference, so I have set winaltkeys=no from my vimrc.  This problem does
> seem a little conspicuous to me, since it is not just some keys, but _every_
> key.  GVIM is only responding to <M-C-k> if k is an arrow key, or some other
> control key like <BS>,<Del>,<Ins>.
>
> I will upgrade as you suggested, and see if that helps...
> Thanks again.
>
> -WES
>
> Hm, if Ctrl-V (or Crl-Q if you use Ctrl-V to paste) followed by Ctrl-Alt-<letter> fails to elicit any response (with 'showmode' on, the ^V or maybe ^Q remains in the lower right corner, and nothing appears in the buffer), then for some reason Vim doesn't get that key. Maybe the OS snatches it, I don't know. It might be better in gvim than in Console Vim, but no guarantee.
>
> In general, the "best" keys for the {lhs} of a mapping (keys which Vim will receive and which don't already have a preset binding) are the function keys, F2 to F12 (F1 is already Help, and F10 may or may not be a Menu key), then after that on many systems Shift-F1 to Shift-F12 (on Linux, Ctrl-F1 to Ctrl-F12 are usually reserved by the window manager for its own purposes, but if you run Vim only on Windows they should be usable too).
>
>
> Best regards,
> Tony.
> =============================================
>
> Hi Tony,
>
> Yep, that is what happens: ^V just sits in the corner in spite of me banging
> on pretty much every <M-C-x> key.  This is in GVIM on windows 7, and I have
> now updated to version 7.3.289 (thanks for the tip, by the way).
>
> The function keys are a good suggestion, however the problem is that I had
> planned on using the above combination frequently during typing: my intent was
> to use a mapping like this >
>     :imap<C-M-L>  <C-Right>
>
> to quickly move a word right without leaving insert mode.  In my other
> (non-modal) editor, I use the Alt key to kind of "temporarily enter normal
> mode", in Vim terms.  I find it a bit slow to leave insert mode, enter the
> right command, and then come back, just to skip over a word.  (However, this is
> only day 4 of my Vim usage, so maybe I'll get used to it.)
>
> Anyhow, can anyone with the same setup as mine confirm that this is hopeless?
> I have several other editors that respond to all of these keys, and I've read
> plenty of other accounts online of people mapping <M-C-x> (although not on
> windows) so I'm thinking that maybe there's still hope...
>
> Thanks!
>
> -WES

Have you tried the i_CTRL-O command to execute just one normal mode command
and return to insert mode, see ':help i_CTRL-O'. In your case: <C-O>W.

Best,
Marcin

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: