Monday, December 17, 2018

Re: remap C-\ to a different C- key ?

On Mon, Dec 17, 2018 at 1:58 PM M Kelly <mckelly2833@gmail.com> wrote:
>
> Tony, hi
>
> Sorry for not being more precise -
> I mean make another key do what C-\ does, but my difficult point is
> that another program (like a window mgr etc.) might grab C-\ before vim,
> so I don't mean map C-x to C-\ for exmaple.
>
> thx,
> -m

Apparently you didn't try.

The best keys to use as {lhs} in Vim are the Fn keys, with or without
Shift (your window manager might grab those with Ctrl) with the
exception of unshifted F1 (Help) and possibly F10 (Menu), plus any
non-ASCII printing key your keyboard might have (for instance mine has
² ³ § é è ç à ù µ £ plus a dead key for diaeresis and circumflex, and
that's before adding all my AltGr combinations).

So I tried
:cmap <S-F12> <C-\>
(in my usual gvim, a Big build of Vim 8.1.606 with GTK2 GUI) and it
worked (i.e. Shift-F12 e on the command line did what Ctrl-\ e is
supposed to do). (The operands are of course typed in full, in <>
notation.)

To remap it in all modes, use both
:map <S-F12> <C-\>
:map! <S-F12> <C-\>
possibly replacing <S-F12> by the <> representation of any other Fn
key you aren't yet using as the {lhs} of a mapping.


Best regards,
Tony.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment