Stop Alt key bringing up the menu in Sublime Text 2

佐手、 提交于 2019-12-20 16:20:42

问题


I'm an Emacs user looking into Sublime Text 2. I've remapped the default Emacs key bindings and have become accustomed to moving about using Alt+i, Alt+k, Alt+j, Alt+l for up, down, left and right. I haven't had any issues remapping those keys in Sublime Text.

The problem is that whenever I use these keys to navigate the menu pops up even though I've hidden it in distraction free mode. I would like to stop the menu coming up when I press the Alt key.

If possible I would like to remap the key for displaying the menu to something else (like Alt+space). Otherwise I would like to disable the menu coming up with the Alt key altogether (and use hot keys and the console for everything).

I'm running Sublime Text on Windows XP.


回答1:


The problem I was having was that a key I was rebinding conflicted with a mnemonic on the menu. Specifically, I had Alt+i mapped to something while it was also the mnemonic for Find.

To fix the problem I removed the mnemonics from the menu, which stopped the menu appearing. To do this go to Preferences -> Browse Packages and open the Default/Main.sublime-menu file. In there you can remove all of the "mnemonic": "*", lines to get rid of the mnemonics.

Pressing the alt key will still bring up the menu. If you want to disable this you can use the following AutoHotkey script (thanks Armin):

SetTitleMatchMode RegEx
#IfWinActive .*Sublime Text 2.*
    LAlt & esc::return ;This can be any key, not just escape. It's needed to get AutoHotkey to treat Alt as a prefix key.
    ~LAlt::return
#IfWinActive

This only stops left Alt bringing up the menu, right Alt will still work as usual.




回答2:


If you use Autohotkey, you can try to use #IfWinActive which will only apply hotkeys if a certain windows is active. Then your code would look something like this

#IfWinActive, Emacs ; the name of the window
~LAlt::return ;this enables the LAlt + hotkey action but disables LAlt
LAlt & space::tooltip,do stuff
...
#IfWinActive ;end


来源:https://stackoverflow.com/questions/15153367/stop-alt-key-bringing-up-the-menu-in-sublime-text-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!