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?
4 Answers
This is probaby what you want: :imenu disable Help
-
Tried the command, but when press alt+h, the Help menu is still popping out.– FisherMar 20, 2018 at 10:05
-
-
Found a way: remove the menu bar :set guioptions -=m
.
Thanks below link.
How to hide the menu/tool bar of gvim?
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.
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.
'winaltkeys'
case isn't covered by "How to debug a mapping?"