0

I want to map <M-h> to in insert mode. I add imap <M-h> <Left> to .vimrc.
But if I press <M-h>, Help menu will pop up. How to disable this and force <M-h> to in insert mode?

enter image description here

4
  • How to debug a mapping? Which helpmenu pops up? Your terminal's one? Then the problem doesn't come from Vim.
    – statox
    Mar 15, 2018 at 12:57
  • If this help menu comes from the terminal, that means, that the actual key mapping does not reach vim but is intercepted by the terminal or your system. So please be more specific, what kind of help menu? Mar 15, 2018 at 13:17
  • @statox, Christian Brabandt, I'm using gvim. Just upload the screenshot.
    – Fisher
    Mar 15, 2018 at 14:06
  • @statox, 'winaltkeys' case isn't covered by "How to debug a mapping?" Apr 19, 2018 at 14:30

4 Answers 4

1

This is probaby what you want: :imenu disable Help

3
  • Tried the command, but when press alt+h, the Help menu is still popping out.
    – Fisher
    Mar 20, 2018 at 10:05
  • are you sure you were in insert mode?
    – tivn
    Mar 20, 2018 at 10:09
  • Yes, I was in insert mode, just tried again.
    – Fisher
    Mar 20, 2018 at 10:21
1

Found a way: remove the menu bar :set guioptions -=m.

Thanks below link.
How to hide the menu/tool bar of gvim?

1

The default gvim menus are located at $VIMRUNTIME/menu.vim. You can copy this file into your local vim settings, disable loading of the default menus with :let did_install_default_menus=1 in your .vimrc (see :help menu.vim), and then source the copy which you will edit. You'll notice that the commands to add the Help menus (like :an 9999.10 &Help.&Overview<Tab><F1> :help<CR>) have ampersands before the 'H' in 'Help'; this ampersand decides shortcut keys. You could then change the shortcut key, or remove it altogether while still retaining the Help menu.

1

Alt key is in competition between mappings and menus.

To choose which one has the priority, you'll need to set 'winaltkeys'. Set it to no in order to completely ignore menu alt-shortcuts.

This solution is less intrusive than the one where menu bar is completely removed. The menu is still displayed, we just loose the shortcuts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.