modifyOtherKeys ?

198 views
Skip to first unread message

mckel...@gmail.com

unread,
Apr 5, 2021, 4:33:41 PM4/5/21
to vim_use
Hi,

Thx always for everything vim.
With the other vim I can map almost any key with modifiers, but with vim I cannot.
For example to map Alt-y I want to:
nmap <A-y> ...
but this never works. Instead I use up a function key so I dont have a slow <Esc> issue.
Is there a way to set modifyOtherKeys in vim for this ?  Is there a build option for it ??

thx,
-m

mckel...@gmail.com

unread,
Apr 5, 2021, 11:44:46 PM4/5/21
to vim_use
Hi,

ok, well RTFM as they say ...

:h modifyOtherKeys shows me -

For xterm modifyOtherKeys is enabled in the builtin termcap entry.  If this is
  not used you can enable modifyOtherKeys with these lines in your vimrc:
        let &t_TI = "\<Esc>[>4;2m"
        let &t_TE = "\<Esc>[>4;m"

I'm excited to try it out.

thx for all things vim,
-m

mckel...@gmail.com

unread,
Apr 6, 2021, 1:57:45 PM4/6/21
to vim_use
Hi,

This setting for me still does not allow a:

nmap <A-y> ...

to work as I think it is supposed to in vim.
Anyone have any suggestions ?
If this is expected behavior then fine, just wondering if anyone knows its expected.

thx,
-m

Christian Brabandt

unread,
Apr 6, 2021, 2:12:34 PM4/6/21
to vim_use



On Di, 06 Apr 2021, mckel...@gmail.com wrote:
> Hi,
>
> This setting for me still does not allow a:
>
> nmap <A-y> ...
>
> to work as I think it is supposed to in vim.
> Anyone have any suggestions ?

What exactly do you expect? What does :nmap <a-y> output?
Is this with or without modifyOtherKeys? Did you try it in an xterm or
in the GUI (gvim)?


Best,
Christian
--
Man soll nicht nur des Leibes wegen, sich an die Seit' des Weibes legen.

mckel...@gmail.com

unread,
Apr 6, 2021, 9:13:22 PM4/6/21
to vim_use
Christian, hi

If I use neovim the mapping works as expected.
With vim it does not.  Same terminal and settings.
I am using a terminal that has modifyOtherKeys set to 2.
I have made sure t_TI and t_TE are set to the above as described in the help.
I have also checked with some other programs that show the key pressed as 'M-y'

Does a simple nmap like <A-y> k (or <M-y>) work for you in vim ?
The mapping does not complain or report any issue, it just does not work.
If I use nmap <Esc>y k it works.
I am sure many would say go away and just use <Esc>y or set <F22> = "\ey" and nmap <F22> <A-y>.
Its all ok - I just thought vim would support the <A-y> or <M-y> mapping as I've configured it.
Perhaps its some other setting that vim requires that I need to keep researching ?

thx,
-m

mckel...@gmail.com

unread,
Apr 6, 2021, 9:16:56 PM4/6/21
to vim_use
Hi,

A few more answers -
I used terminal vim (not gvim).
I actually tried a few different terminals, but all were the same.
I will keep researching.
gvim does work ok, so its just the terminal vim that I'm asking about.

thx,
-m

Bram Moolenaar

unread,
Apr 7, 2021, 1:01:30 PM4/7/21
to vim...@googlegroups.com, mckel...@gmail.com

> If I use neovim the mapping works as expected.
> With vim it does not. Same terminal and settings.
> I am using a terminal that has modifyOtherKeys set to 2.
> I have made sure t_TI and t_TE are set to the above as described in the
> help.
> I have also checked with some other programs that show the key pressed as
> 'M-y'
>
> Does a simple nmap like <A-y> k (or <M-y>) work for you in vim ?
> The mapping does not complain or report any issue, it just does not work.
> If I use nmap <Esc>y k it works.
> I am sure many would say go away and just use <Esc>y or set <F22> = "\ey"
> and nmap <F22> <A-y>.
> Its all ok - I just thought vim would support the <A-y> or <M-y> mapping as
> I've configured it.
> Perhaps its some other setting that vim requires that I need to keep
> researching ?

This sounds like you have "meta sends escape" enabled, which can cause
various problems. So first thing is to disable that.

Also see https://github.com/vim/vim/issues/5200

--
hundred-and-one symptoms of being an internet addict:
82. AT&T names you Customer of the Month for the third consecutive time.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

mckel...@gmail.com

unread,
Apr 13, 2021, 8:51:00 PM4/13/21
to vim_use
Hi,

Thanks for the info Bram.
I changed my terminal to send CSI sequence [27;3;121~ for M-y and a vim mapping for <M-y> now works :-)
It was related to altSendsEsc logic about what the terminal should send for these keys.

thx again for all things vim,
-m

Reply all
Reply to author
Forward
0 new messages