Skip to main content
24 votes
Accepted

Differences between evil-normal-state-map and evil-motion-state-map

Motion state is an Evil-specific thing, intended for modes where you don't edit text, but still want Vim-style movement available, with all other keys of that mode passing through. Help buffers are ...
wasamasa's user avatar
  • 22.2k
23 votes
Accepted

What is the longest known key sequence in Emacs?

I tested with the following script, (key-description (car (sort (let (keyseqs) (mapatoms (lambda (sym) (when (commandp sym) (let ((where (where-is-internal sym nil ...
mkcms's user avatar
  • 1,370
9 votes
Accepted

How do I use Mac/OSX key bindings with Spacemacs?

Spacemacs has a "layer" called "osx" that should do everything you want. https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Bos/osx Just put osx in the dotspacemacs-configuration-layers ...
mclear's user avatar
  • 1,565
9 votes

Change default company mode keybindings

I read about Change Minor Mode Keys in the fantastic Xah Lee pages. And I think I came with a solution. I found two different keymaps in company.el: company-active-map and company-search-map. So I ...
nephewtom's user avatar
  • 2,281
8 votes
Accepted

How do I keep Mac Emacs from trapping M-`?

What's going on here is that ⌘-⇥ is a low-level hotkey that can't be intercepted (a good thing, too, since it may be one of your only escape hatches if a full-screen game hangs, along with the force-...
Trey's user avatar
  • 905
8 votes
Accepted

How to make `C-x 9` the same as `C-x 8 "`

I can think of a couple of ways to do this. The main practical difference is whether you see C-x 8 " or C-x 9 in the minibuffer while waiting to read the next key. Option 1 is to simulate the ...
phils's user avatar
  • 51.7k
8 votes
Accepted

No commands with a binding that start with C-c C-x

The reason C-x seemingly appears in every keymap is that it's in key-translation-map and function-key-map. These are some of several keymaps that translate input before it gets to the “real” keymaps (...
Gilles 'SO- stop being evil''s user avatar
7 votes

How can I send Super from my Mac to my Emacs instance?

You can apply a super modifier with C-x @ s. So to type Super+z, you woule press C-x @ s z. If you find the C-x @ s combo too cumbersome, then you can bind it to something easier to type. Here is ...
nispio's user avatar
  • 8,255
7 votes

What is the longest known key sequence in Emacs?

I can't answer about what the longest might be out there somewhere, but here's one bit of info that might help. I have some libraries that provide a set of related commands bound to keys in a keymap ...
Drew's user avatar
  • 78k
7 votes

How can I get RET to follow org-mode links when using evil-mode?

The easy way out is to unbind RET for Evil as it isn't bound to a useful command anyway. This will let Emacs look it up in keymaps with less priority. You can do the same with SPC and TAB (keep in ...
wasamasa's user avatar
  • 22.2k
6 votes
Accepted

how to define bindings for multiple keymaps with bind-keys?

You can iterate over the list of modes: (dolist (m (list org-mode-map emacs-lisp-mode-map)) (bind-keys :map m :prefix-map f14-prefix-map :prefix "<f14>" ...
db48x's user avatar
  • 18.4k
6 votes

How do I list all key-bindings available in a given buffer?

Currently, probably the best way to discover keybindings is by using the which-key package. This package is central in distributions like Spacemacs and Doom emacs. It provides various commands for ...
dalanicolai's user avatar
  • 7,880
6 votes
Accepted

How to set the keybinding for addind the hash symbol (#) in spacemacs with MacOS and an UK keyboard

Another approach is set (setq-default mac-right-option-modifier nil) to your dotspacemacs/user-init and start to use the "right Option+3" key to write the '#' symbol. Definition: (defun dotspacemacs/...
Joao Ferreira's user avatar
6 votes
Accepted

Turn keymap number back to key sequence

You can use single-key-description to convert a number into a key in string form, for example, ?\C-x => 24 (single-key-description 24) => "C-x" I have the following in my init file: ...
xuchunyang's user avatar
  • 14.6k
6 votes
Accepted

How do I get rid of RET being translated from <return>?

For clarity: "RET (translated from <return>)" tells you that Emacs is receiving <return>. That's what your OS sent it when you typed that key. You want Emacs to translate <return> ...
phils's user avatar
  • 51.7k
6 votes

How are major modes and local keymaps associated?

You do have to be a bit careful with the terminology. Each buffer has a single "local keymap", and therefore it's sensible to avoid using that terminology to refer to other keymaps. current-local-...
phils's user avatar
  • 51.7k
5 votes

Keycode for `Shift + Return` on OS X iterm2

C-c C-x M is an alternative for M-S-Ret http://orgmode.org/manual/TTY-keys.html#TTY-keys
Eric Ihli's user avatar
  • 255
5 votes
Accepted

define bindings of map a into map b

You can get the effect you want by setting a keymap's parent, see (elisp) Inheritance and Keymaps A keymap can inherit the bindings of another keymap, which we call the "parent keymap". Such a ...
npostavs's user avatar
  • 9,223
5 votes
Accepted

Copy Paste - Hard to use with one Hand

I don't have the precise quote, but if memory serves, the original author of Emacs default keybindings is Guy Lewis Steele. You should be able to find a mention of this fact in the book Coders at ...
wvxvw's user avatar
  • 11.4k
5 votes
Accepted

What is the difference between `C-i` and `<C-i>`?

I'm interested in getting a C-i not a \t C-i and \t are the same thing (ASCII character 9; aka TAB). If you want the TAB key to be different to C-i you can achieve that in a GUI environment (but not ...
phils's user avatar
  • 51.7k
5 votes
Accepted

What function does C-x invoke?

In the default configuration, it is not a complete key sequence: it is a prefix key. It is an incomplete specification: it has to be followed by another key (or more than one, if the next key is also ...
NickD's user avatar
  • 31k
5 votes

How does `C-x z` work?

The code is in repeat.el. See command repeat, which is what C-x z is bound to. The code uses the fact that Emacs records the current command and the last command in variables. The repeat code resets ...
Drew's user avatar
  • 78k
5 votes
Accepted

local-map in header line

A click on the mode-line does not generate the event sequence [mouse-1] but [mode-line mouse-1] and similarly a click on the header line generates the sequence [header-line mouse-1], so you need to ...
Stefan's user avatar
  • 26.5k
5 votes
Accepted

Define new key binding for new minor mode

Your code works perfectly, for me. Did you try it in emacs -Q (no init file)? And if I load library help-fns+.el and then use M-k hello-mode-map it shows me that M-p is bound to an (anonymous) command....
Drew's user avatar
  • 78k
5 votes
Accepted

Is it possible to have a minor mode re-evaluate its keymap?

Minor Mode Keymaps The problem with the current code in the question is that it merely updates the variable foo-mode-map but it does not really update the keymap data structure made of cons cells that ...
Susam Pal's user avatar
  • 186
4 votes
Accepted

Respect default action in keymap with Meta keys?

For historical reasons, M-key and ESC key are mostly treated as equivalent. Physical terminals, and terminal emulators, communicate with the application by sending characters, and there's no character ...
Gilles 'SO- stop being evil''s user avatar
4 votes
Accepted

How to list keybinding for a particular keymap (evil-mode)?

I don't know of any way to do this in vanilla Emacs without effective writing your own code, but the function describe-keymap (C-h M-k) in the help-fns+.el package does exactly this. describe-...
Arthur's user avatar
  • 87
4 votes

how to add a prefix key to all keybindings of a specific mode?

One way to move -mode's keybindings could be with something like (let ((origmap <foo>-mode-map) (newmap (make-sparse-keymap))) (define-key newmap <prefix> origmap) (setq <foo&...
Stefan's user avatar
  • 26.5k
4 votes
Accepted

Disable C-Tab in magit mode

According to Remove key binding in magit-status-mode use in init.el (with-eval-after-load 'magit-mode (define-key magit-mode-map (kbd "<C-Tab>") nil)) The (with-eval-after-load FILE &opt ...
Konstantin Morenko's user avatar
4 votes
Accepted

How to define a key in 'special-mode?

I think you can use special-mode-map when possible. When it doesn't work, simply use the corresponding mode map such as Info-mode-map. The following (needs bind-key.el) might works (I tested in info-...
xuchunyang's user avatar
  • 14.6k

Only top scored, non community-wiki answers of a minimum length are eligible