Friday, April 23, 2021

Re: Gvim and Alt-F10

On Fri, Apr 23, 2021 at 6:26 AM cjsmall <jefferysmall@gmail.com> wrote:
>
> Following up to my own post:
>
> Tony was correct. It turns out that I CAN map the Alt-F10 key after all
> and it does do what I want withing gvim. However, if that key combo
> is not mapped, then the File pull-down menu gets displayed. I was
> confused because I have some mappings defined in .vimrc files
> local to certain directories, but I have some master unmapping
> definitions defined in my master (global) vimrc file. I was working on
> the master file first, adding gvim unmapping definitions in parallel
> with my working unmapping definitions for standard terminal use.
> In other words, I was adding gvim blocks using:
>
> if has ('gui_running')
> <additions>
> else
> <standard unmappings>
> endif
>
> None of the Alt-Fn keys were actually mapped at this point and
> thus, Alt-F10 was always failing over to the File pull-down menu.
> However, when I went to the directories where the mapping
> definitions were actually defined, then whenever I edited a file
> where Alt-F10 was actually mapped, it worked as desired!
>
> Once I realized all this, I was able to deactivate Alt-F10 from
> interacting with the File menu by making sure it was always
> defined by adding the following to the master vimrc:
>
> if has ('gui_running')
> " Stop Alt-F10 from pulling down the File menu
> nnoremap <M-F10> <nop>
> inoremap <M-F10> <nop>
> endif
>
> I hope that explanation makes sense. Sorry to bother everyone
> with my confusion as to what was actually going on. A big
> thanks to Tony for his very detailed reply.

It does indeed make sense. Using <Nop> as the {rhs} of a mapping is
the canonical way to make sure that the corresponding {lhs} does
nothing. There are rare cases where certain keys cannot be used as the
{lhs} of a mapping but usually it works.

Best regards,
Tony.
>
>
> On Thursday, April 22, 2021 at 7:18:56 PM UTC-7 cjsmall wrote:
>>
>> The window manager is possibly responsible for some of these
>> Alt assignments. In gvim. on my system, Alt-[FETSBWH] display
>> the File/Edit/Tools/Syntax/Buffers/Window/Help pull-down
>> menus. Alt-F10 is the only function key of the twelve that is
>> being co-opted and duplicating the Alt-F function. This is why
>> I thought that it might be specific to gvim and was hoping that
>> there was a way to control this externally without having to
>> recompile from scratch.
>>
>> As for the build, 8,.1 is the current package in the Ubuntu
>> repository. It is using GTK3 and was compiled a year ago
>> on 04-15-20. It would be great if Sven or someone could goose
>> the maintainer to update the package. I've tried! :-(
>>
>> On Thursday, April 22, 2021 at 5:56:48 PM UTC-7 antoine.m...@gmail.com wrote:
>>>
>>> it applies tOn Fri, Apr 23, 2021 at 12:31 AM cjsmall
>>> <jeffer...@gmail.com> wrote:
>>> >
>>> > I'm on Xubuntu 20.04 and using vim 8.1
>>> >
>>> > In gvim, the Alt-F10 key is co-opted to display the File pull-down menu. I have a series of remapped assignments for all of the function keys. These all work well for vim in a terminal window, but this single one fails due to this built-in menu assignment.
>>> >
>>> > Is there an easy way to deactivate this so that the Alt-F10 code (<M-F10>) can be assigned to my purpose?
>>> >
>>> > Thanks.
>>>
>>> You didn't say which GUI you are using (I'm using GTK3); also, Vim 8.1
>>> is getting a little long in the teeth IYSWIM. Vim 8.2 was released on
>>> 12 December 2019 and its latest patchlevel is 8.2.2800. It is
>>> conceivable that one of these two thousand eight hundred patches fixes
>>> your problem; but otherwise, see below.
>>>
>>> I'm on openSUSE 15.2 and here, hitting Alt-F10 on a virtual desktop
>>> unmaximizes the top window, no matter which one — it applies to my
>>> browser as well as to gvim. Repeating the action reverses the process.
>>> The Alt-F10 combo doesn't even reach gvim here. OTOH Alt+letter
>>> triggers (in gvim with GTK3 GUI) the menus on the menubar: Alt-F is
>>> File, Alt-E is Edit, Alt-T is Tools, etc. IIUC this behaviour depends
>>> on the 'winaltkeys' settings.
>>> See :help 'winaltkeys'
>>>
>>> If you don't want the GUI menus at all, you can disable them by
>>> removing the m flag from the 'guioptions' setting; OTOH, even without
>>> the menus-on-top there is still a separate ways to get the same menus
>>> at the bottom in both gvim and Vim, see
>>> https://vim.fandom.com/wiki/Text_mode_menus
>>>
>>> In my experience, the most portable {lhs} key assignments for mappings
>>> are F2 to F9 and F10 to F12 in both Vim and gvim, and in addition
>>> Shift-F1 to Shift-F12 in gvim. F1 is reserved for Help. F10 may either
>>> be the system menu, or it may be available too. Others might or might
>>> not work for reasons external to Vim.
>>>
>>> If when you do
>>> :verbose map <M-F10>
>>> in gvim, the answer is either "No mapping found" or your own defined
>>> mapping, then if gvim does something else when you hit that key combo,
>>> the reason is to be found outside of Vim. Maybe in the settings of
>>> your window manager, if you can get at them. Otherwise, if you still
>>> have some not yet taken mappable key (maybe a non-ASCII key like the
>>> ³² and £µ keys present on my keyboard), try moving whatevr you have on
>>> Alt-F10 to some such key.
>>>
>>> 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.
> To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/e2e203a5-6da2-4b77-85e5-0a9309733b4cn%40googlegroups.com.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXvBz1TJLM0E6%3DvV8g%3DtSDYz-fyfmnyhVy_q8WJXOR%2BShQ%40mail.gmail.com.

No comments: