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.

1424 questions
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
  • 920
  • 9
  • 19
26
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
  • 391
  • 1
  • 3
  • 5
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,648
  • 1
  • 22
  • 51
18
votes
1 answer

How to use a Mac's Command key as a Control key?

I'm new to Emacs, and am using a Mac. I want the Mac command key to act as a control key for Emacs. How do I do that? I tried (setq mac-command-modifier 'control). Besides, how do I find key variable and local key names in Emacs? For example:…
LoranceChen
  • 305
  • 1
  • 2
  • 10
17
votes
1 answer

Best (minimal keystrokes) method of jumping to the start of a function and then back to current point?

Sometimes I'm inside a long function where the start of the function is not visible. While I have recently learned about (which-function-mode) which tells me in the modeline the name of the function, I'd like to be able to quickly jump to the start…
Harvey
  • 978
  • 6
  • 15
15
votes
2 answers

How to bind C-[ for real?

C-[ is equivalent to the escape key on US English keyboards, thus, any attempt at binding it will mess up M- behaviour. Emacs seems to have no trouble telling and C-[ apart in GUI frames. The following works fine and bindings starting with…
Kristóf Marussy
  • 616
  • 4
  • 10
15
votes
2 answers

How to distinguish C-m from RETURN?

When in javascript mode trying to use C-c C-m i get an error saying "C-c RET is undefined?" What makes Emacs believe I am pressing RET? How can i properly make this keybinding work?
user3139545
  • 323
  • 3
  • 8
14
votes
4 answers

How to remove bindings to the ESC prefix key

I'd like to use the ESC key instead of C-g for keyboard-quit. My naïve approach to just do (define-key global-map (kbd "ESC") 'keyboard-quit) does not work. ESC is still a prefix key and pressing it does not call keyboard-quit.
Geier
  • 722
  • 5
  • 15
11
votes
1 answer

what is the `A-` binding?

On Emacs, if I type C-h, b a list of keybinds come up, including: what is A- and how do I access it?
zcaudate
  • 647
  • 4
  • 14
11
votes
1 answer

Define Control+Shift keys without kbd

I'm trying to add some functionality to someone else's package, and so I'd like to respect their patterns. Unfortunately, one of these patterns is to not use kbd. I need to bind a function to C-S-b, but I can't figure out how. I know how to do this…
Malabarba
  • 23,148
  • 6
  • 79
  • 164
11
votes
5 answers

Avoiding overwriting global key bindings

Okay, this is a persistent problem for me. As I continue to use emacs more and more, I'm starting to customize it to my needs by installing the packages(and/or defining functions) and the one big problem I face when I configure a package is:- what…
Chakravarthy Raghunandan
  • 3,192
  • 2
  • 19
  • 43
10
votes
3 answers

Emacs bind key to prefix

suppose I want to bind a key to a partial key sequence (i.e. a key sequence that is a prefix of some other bound keybindings). I've tried the obvious (global-set-key (kbd "C-x C-x") (kbd "C-c")) But that doesn't work for some reason.
PythonNut
  • 10,363
  • 2
  • 30
  • 76
9
votes
3 answers

Is there a way to know which keys or functions I used most?

If I can find out which keys I used most, I may create a macro for it; if I can find out which function I used most yet not binded, I can bind it to a key. This may improve efficiency. Is there a way to get these statistics knowledge?
Nick
  • 4,473
  • 4
  • 26
  • 44
9
votes
7 answers

My left pinky hurts. Can I press another key to act as Control?

My left pinky hurts due to repetitively pressing the C button when using Emacs org mode. Not working with Emacs is out of the question, but it needs some rest. I would like to change theC key for something else for a while. Could I use, say, the ','…
1
2 3
17 18