Questions tagged [key-bindings]

Keyboard shortcuts, key chords, key sequences, hotkeys, or any association between key combinations and corresponding actions in Emacs.

Anything related to key-bindings (a.k.a. keyboard shortcuts, hotkeys, etc.), i.e. the associations between key combinations and the corresponding actions triggered when the user presses such combinations.


For example, pressing keyboard key Alt + F4 closes an application on Microsoft Windows, while Ctrl + C copies the selected text into the clipboard for both Linux and Windows GUI applications.

The Emacs (logical) key sequences that are associated with such physical keyboard keys are typically M-<f4> (or ESC <f4>) and C-c, respectively.

It is Emacs key sequences that are used in Emacs key bindings.

See the Elisp manual, node Key Sequences.

1379 questions
88
votes
25 answers

How do I switch buffers quickly?

In vanilla Emacs, I have to do C-x b and then manually type out the buffer name to switch. If I forget the name of the buffer, I have to hit TAB to list possible completions. Is there anything I can do to make this process faster?
nixeagle
  • 2,407
  • 3
  • 17
  • 14
72
votes
4 answers

How can I find out in which keymap a key is bound?

I have rebound a the 'd' key in gnus-article-mode, but its old behavior is still active when the point is on an attachment. I can see that the rebinding did not take effect there by doing C-h k d, but it is not telling me what keymap is in effect at…
brab
  • 925
  • 1
  • 7
  • 8
65
votes
8 answers

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

I am trying out a new major mode, how can I take advantage of Emacs' documentation system to get a listing of key bindings available in that specific buffer?
nixeagle
  • 2,407
  • 3
  • 17
  • 14
54
votes
6 answers

How to override major mode bindings

Sometimes my global keybindings are overridden by a major mode. An easy example is the following setting in my init file (global-set-key (kbd "C-j") 'newline-and-indent) But annoyingly this keybinding is hidden by the "Lisp Interaction" major mode…
nispio
  • 8,175
  • 2
  • 35
  • 73
41
votes
6 answers

Problems with keybindings when using terminal

I have the following line in init.el: (global-set-key [(control \;)] 'comment-region) It works very well in GUI window, but if emacs is invoked with the -nw option then C-; doesn't comment region, only inserts ; character. M-x comment-region RET…
36
votes
4 answers

Show unbound keys

I want to define some key bindings for my new found usage of helm, amazing mode btw, and I want to do it without overwriting the usage of other keys. I realize that the number of different key combinations is infinite, but is there some way to see…
c-o-d
  • 910
  • 9
  • 19
32
votes
4 answers

How can I simulate an arbitary key event from Elisp?

Is it possible to simulate an arbitrary key event from elisp? I am aware of ways that I can find the binding for a given key, and then call that command interactively, but what if that key event is not bound to a command? As one example, what if I…
nispio
  • 8,175
  • 2
  • 35
  • 73
30
votes
1 answer

How to distinguish C-i from TAB?

Normally, for historic reasons, emacs treats the TAB keycode and the C-i key as the same, cf. the emacs lisp documentation on function keys or abo-abo's answer on the question "What is the difference between TAB and ?". NOTE: In this post, keycodes…
elemakil
  • 2,517
  • 1
  • 18
  • 26
27
votes
3 answers

How do I make pressing in helm-find-files open the directory?

When I run #'helm-find-files, and move point to a directory, pressing results in opening that directory in dired mode. One has to press C-j to enter that directory in Helm. I'd like to have act as C-j does here, but not necessarily…
zck
  • 8,984
  • 2
  • 31
  • 65
26
votes
2 answers

What are these prefix commands that start with s-l?

I'm using lsp-mode, and I see these weird prefix commands that start with s-l. How do I type them? `lsp-mode' Minor Mode Bindings: key binding --- ------- s-l Prefix Command C-S-SPC …
Jim Hunziker
  • 425
  • 4
  • 6
26
votes
3 answers

How can I stop the enter key from triggering a completion in company mode?

I often want to go to a newline while the company mode suggestion is showing. How can I set up company mode so only the tab key triggers a completion?
Connor
  • 1,591
  • 1
  • 19
  • 26
24
votes
3 answers

How to unbind a key?

I want to get rid of the C-e binding so I can bind C-e e, and C-e r to a command. How do I do this? My init file has this: (global-set-key (kbd "C-e e") 'move-end-of-line) (global-set-key (kbd "C-e r") 'end-of-buffer)
Joshua Lilleberg
  • 371
  • 1
  • 2
  • 5
23
votes
2 answers

set-mark-command (C-SPC) not recognised/broken

I would like to know how to start troubleshooting the following: C-SPC is not doing anything. It's not appearing in the mini-buffer when I type it but when I look at M-x set-mark-commandit's showing as bound to C-SPC. Environment I've installed GNU…
m__
  • 923
  • 1
  • 7
  • 12
22
votes
2 answers

Is there a function to insert the correct `(kbd "...")` by pressing the key?

I'm bored of looking up key names for the kbd function, is there a way to automatically insert the correct key name just by pressing the key? So for example I want something to do this: I'm typing (local-set-key | I run magical-insert-kbd-command,…
dshepherd
  • 1,281
  • 6
  • 18
20
votes
1 answer

What is the difference between TAB and ?

I was reading the the documentation for Yasnippet mode, when I came to the section where the trigger key is defined: It seems like Yasnippet minor mode defines the TAB key to run yas-expand using: (define-key yas-minor-mode-map (kbd "")…
Håkon Hægland
  • 3,608
  • 1
  • 20
  • 51
1
2 3
91 92