[vim/vim] alt+space does not show system menu with winaltkeys=menu (Windows) (Issue #11591)

68 views
Skip to first unread message

Dan Thompson

unread,
Nov 22, 2022, 11:19:58 PM11/22/22
to vim/vim, Subscribed

Steps to reproduce

gvim.exe --clean
:set winaltkeys=menu // that should be the default, but being explicit here
alt+space

Expected behaviour

I should see the "system menu"--that little old-school menu at the top left corner that has entries for Restore, Move, Size, Minimize, Maximize, Close.

(Other menu entries work, like alt+f for the "File" menu, etc. It also works as expected if :set winaltkeys=yes. But I don't think alt+space should be mapped to anything by default, so it should go to the windowing system when winaltkeys=menu.)

Version of Vim

9.0.924

Environment

Windows 11

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11591@github.com>

Christian Brabandt

unread,
Dec 8, 2022, 4:07:26 PM12/8/22
to vim/vim, Subscribed

If I read :h simalt and :h 'winaltkeys' correcty, you need to set :set winaltkeys=yes to make this work. If you use the winaltkeys=menu you need to use :simalt ~ instead, because this only works for the menu keys and I don't think the system menu belongs to the menubar. Pasting the documentation here for clarity:

Some GUI versions allow the access to menu entries by using the ALT
key in combination with a character that appears underlined in the
menu.  This conflicts with the use of the ALT key for mappings and
entering special characters.  This option tells what to do:
  no    Don't use ALT keys for menus.  ALT key combinations can be
        mapped, but there is no automatic handling.  This can then be
        done with the |:simalt| command.
  yes   ALT key handling is done by the windowing system.  ALT key
        combinations cannot be mapped.
  menu  Using ALT in combination with a character that is a menu
        shortcut key, will be handled by the windowing system.  Other
        keys can be mapped.
If the menu is disabled by excluding 'm' from 'guioptions', the ALT
key is never used for the menu.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11591/1343352830@github.com>

Tony Mechelynck

unread,
Dec 9, 2022, 12:09:44 AM12/9/22
to vim/vim, Subscribed

If Christian's suggestion isn't enough, try adding the following snippet to your vimrc:

  if has('wildmenu')
    set wildmenu
    if exists('+wildmode')
      set wildmode=longest:full,full
    endif
    set wildcharm=<C-Z>
    map <F10> :emenu <C-Z>
    imap <F10> <C-O>:emenu <C-Z>
    if !has('gui_running')
      runtime! menu.vim
    endif " !has('gui_running')
  endif " 'wildmenu'

then hitting F10 will bring up the Vim menu on the statusline in both vim and gvim for use with the keyboard. In gvim it is still available at the top of the Vim screen in the usual (mouse-clicking) manner.

The above snippet uses double-quote comments, it may imply non-Vim9 script in your vimrc, or at least that part of it, unless you rewrite or delete the comments.

Best regards,
Tony.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11591/1343856131@github.com>

Christian Brabandt

unread,
Dec 15, 2022, 7:37:28 AM12/15/22
to vim/vim, Subscribed

I am closing this.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11591/1352998899@github.com>

Christian Brabandt

unread,
Dec 15, 2022, 7:37:29 AM12/15/22
to vim/vim, Subscribed

Closed #11591 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/11591/issue_event/8046850106@github.com>

Dan Thompson

unread,
Jan 10, 2023, 3:35:15 PM1/10/23
to vim/vim, Subscribed

I don't think the system menu belongs to the menubar.

Perhaps there is some technical distinction between alt+space and alt+, but IMO I don't think it makes a difference to a user: a user who wants standard alt+ to automatically work as other Windows programs, without manually mapping them or precluding other custom alt+ mappings, will probably expect alt+space to work when winaltkeys=menu, just the same as alt+f. If there is not a way to query for it, then I would suggest "space" simply be hardcoded as a "menu" key.

That said, I understand that sometimes technical distinctions are important for other reasons, or are more painful/awkward to work around than one might think. And thank you for the pointer to the :simalt command--using that, I can work around the default behavior with the snippet below. So although I think it would be an improvement to also handle alt+space the same as other menu keys, I can live with it.

:map <M-Space> :simalt ~<CR>


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11591/1377814479@github.com>

Reply all
Reply to author
Forward
0 new messages