Set custom keybinding for specific Emacs mode

后端 未结 4 795
余生分开走
余生分开走 2021-01-30 03:15

Though I know how to set a global key-binding in Emacs, I find it hard to even Google out the code for a local (minor-mode specific) key-binding. For instance, I have this code

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-30 03:38

    You need to identify the key map for that mode (for example, LaTeX-mode-map) and use the function define-key. As an example, along with activating outline-minor-mode within LaTeX mode, I have:

      (define-key LaTeX-mode-map [(tab)] 'outline-cycle))
    

    In this case the major mode (LaTeX) holds the key binding, but there is also an outline-minor-mode-map.

提交回复
热议问题