You can use a hook to override major-mode keys.Įmacs: How to Bind Keys for Major Mode? Override Minor Mode Keybinding Major mode usually define its own set of keys, and have priority over global keys. You can set them to ❖ Win or ▤ Menu or ⌥ Opt. Very useful, but depending on which emacs distro/OS you are using, or if you use emacs in terminal or GUI, binding these keys may not work.Īny combination with these is good. Use universal-argument 【 Ctrl+ u】 instead. Combination with Alt or Ctrl or ⇧ Shift is also good. The following keys are good spots for your own definitions, and does not cause any problems in practice. (info "(elisp) Key Binding Conventions"), the key space for users are the function keys F5 to F9, and 【 Ctrl+ c letter】. If you define your own keys without care, you may find that many major mode or minor mode override your keys, because they have priority. By default, 800 of them have key shortcuts.Īll the common key spots are used. See: Emacs's Key Notation: What's the difference between "" and "RET"? Good Key ChoicesĮmacs has some 7 thousand commands. What's the difference between emacs "" and "TAB" key notation? 【 Ctrl+ i】 or Tab ↹ (These are tied together).【 Ctrl+ m】 or Enter ↵ (These are tied together.).Works fine if you always use emacs in a GUI environment. In text terminals, it cannot distinguish shifted and unshifted versions of such combination. Esc by itself has complicated meanings depending when it is pressed and how many times it is pressed.) (The Esc key is tied to 【 Ctrl+ [】 and Meta. For example, type 【 Ctrl+ x】, then type 【 Ctrl+ h】, it'll list what valid keys can follow and the associated command.) (info "(elisp) Help Functions") (This key is used for emacs help system and have a special status in emacs's key system. (due to emacs technical implementation quirk. It's best not to define the following keys, unless you know what you are doing. Emacs: Why You Should Not Swap KeysĮmacs has its quirks.Mac OS X: How to Swap Control, Caps Lock, Option, Command Keys.Microsoft Windows: Swap Caps Lock, Alt, Control Keys.Linux: Swap Control Alt Keys, xmodmap ⌨.You cannot do it within emacs, because these are at the OS level. More examples at Emacs Keybinding Syntax Examples. ( global-set-key ( kbd " ") 'calendar) F7 F8 ( global-set-key ( kbd "C-c t") ' backward-char) Ctrl+c t ( global-set-key ( kbd "C-a") ' backward-char) Ctrl+a Emacs Keybinding Syntax Examples ( global-set-key ( kbd "M-a") ' backward-char) Alt+a If you made some mistake and need to start emacs without loading your init file, you can start emacs from terminal like this: emacs -no-init-file. 〔➤see Emacs: How to Evaluate Emacs Lisp Code〕 If you are experimenting, and don't want to restart emacs every time you try to define a new key, you can place cursor at the end of parenthesis and call eval-last-sexp 【 Ctrl+ x Ctrl+ e】. This page shows you how.įor example, if you want 【 F9】 for calendar, then, place this code (global-set-key (kbd "") 'calendar) in your emacs init file and restart emacs. In emacs, you can create any keyboard shortcut to any command.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |