Skip to main content

Questions tagged [key-bindings]

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

Filter by
Sorted by
Tagged with
90 votes
25 answers
60k views

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 ...
nixeagle's user avatar
  • 2,457
72 votes
5 answers
19k views

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 ...
brab's user avatar
  • 925
68 votes
8 answers
36k views

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's user avatar
  • 2,457
56 votes
6 answers
15k views

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 ...
nispio's user avatar
  • 8,245
41 votes
6 answers
18k views

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, ...
WeSenseASoulInSearchOfAnswers's user avatar
37 votes
4 answers
7k views

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 ...
c-o-d's user avatar
  • 930
34 votes
4 answers
8k views

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 ...
nispio's user avatar
  • 8,245
31 votes
1 answer
4k views

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 ...
elemakil's user avatar
  • 2,537
28 votes
2 answers
8k views

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 ...
Jim Hunziker's user avatar
27 votes
3 answers
4k views

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

When I run #'helm-find-files, and move point to a directory, pressing <ret> results in opening that directory in dired mode. One has to press C-j to enter that directory in Helm. I'd like to ...
zck's user avatar
  • 9,112
26 votes
2 answers
9k views

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 ...
m__'s user avatar
  • 993
26 votes
3 answers
19k views

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-...
Joshua Lilleberg's user avatar
26 votes
3 answers
8k views

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's user avatar
  • 1,611
22 votes
2 answers
762 views

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 (...
dshepherd's user avatar
  • 1,281
21 votes
2 answers
4k views

How to find out what command I just accidentally ran with a keyboard shortcut?

Is there a place where emacs stores commands the user has recently executed, in particular via keyboard shortcuts, and if not, would it be possible to tell it to store them somewhere? I sometimes type ...
Zorgoth's user avatar
  • 840
20 votes
2 answers
3k views

How to bind C-i as different from TAB?

I want to make Control-i perform indent-region (basically since Xcode has built that muscle memory already). I realise that Control-i and tab are indistinguishable in the Ascii sense, but they are in ...
Mark's user avatar
  • 1,449
20 votes
2 answers
5k views

Convention about using C-x or C-c as prefix keys

What are the conventions for using C-x, C-c, or M- as prefix keys? For example: is C-x, etc., for saving or visiting buffers? Is C-c, etc., for text editing? Background Maybe this is a silly ...
anquegi's user avatar
  • 749
20 votes
1 answer
6k views

What is the difference between TAB and <tab>?

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: (...
Håkon Hægland's user avatar
19 votes
7 answers
5k views

Dired "quick-view" key to preview the file at point

I would like to create a function that does a "quick view" of a file the is under point in dired. The way that I would like for this to work is that I hold down a function key, which then makes the ...
Eric Brown's user avatar
  • 3,232
19 votes
1 answer
6k views

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

Documentation for evil-normal-state-map: Keymap for Normal state. Documentation for evil-motion-state-map: Keymap for Motion state. Does Vim have a so-called "motion mode"? In Vim, executing :...
nalzok's user avatar
  • 675
18 votes
1 answer
16k views

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 ...
LoranceChen's user avatar
18 votes
2 answers
3k views

Compose key in Emacs: <Multi_key> is undefined

I set the Alt Gr key on my keyboard as compose key in my system (Ubuntu 14.04) in order to type letters like éóèàùçü and so on. But when I am on Emacs and try to press the Alt Gr key, I have a message ...
petrux's user avatar
  • 677
17 votes
2 answers
4k views

Key bindings specific to a buffer

Is it possible to set key bindings specific to buffer? I have the following in one of my org files: # Local Variables: # eval: (local-set-key (kbd "<f10>") 'some-custom-defun-specific-to-this-...
Kaushal Modi's user avatar
  • 25.7k
17 votes
1 answer
724 views

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, ...
Harvey's user avatar
  • 978
16 votes
9 answers
5k views

What packages are available for modal editing?

What packages are available for modal editing in Emacs? What do you use and why? Let's try to post one package per answer. I propose mention advantages and shortcomings of every package. Here is my ...
16 votes
3 answers
7k views

a confirmation after C-x C-c before exiting Emacs

Can I configure Emacs to ask for confirmation before exiting on C-x C-c? (Sometimes, my fingers press this by mistake.)
imz -- Ivan Zakharyaschev's user avatar
16 votes
4 answers
5k views

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 ...
Geier's user avatar
  • 742
15 votes
3 answers
4k views

Unbinding key using use-package

I'm trying unbind org-cycle-agenda-files which is set by default to C-' and C-,. My weapon of choice to do so is use-package package. On github.com/use-package/bind-key.el page I have found ...
Empty_Mind's user avatar
  • 1,371
15 votes
2 answers
4k views

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's user avatar
15 votes
5 answers
4k views

Use Super in emacs -nw in linux

I have been struggling to find a simple and direct question to the answer and therefore I have decided to ask here. Q: Is there a way to use Super in Emacs launched in a Terminal in Linux? P.S: I ...
Andrea Richiardi's user avatar
15 votes
4 answers
816 views

Differences between setting major mode keys with a hook versus adding them to the mode map

Assume that I have downloaded a major mode called magical-mode, and it has its own magical keymap called magical-mode-map. This mode also provides a hook magical-mode-hook which is run each time ...
nispio's user avatar
  • 8,245
15 votes
3 answers
7k views

Shift+Up isn't recognized by Emacs in a terminal

Very often I use Shift+Up/Down to select a region in Emacs. It works fine in GUI mode, but when emacs is invoked with -nw option I can select lines only with Shift+Down. The Shift+Up doesn't work, I ...
WeSenseASoulInSearchOfAnswers's user avatar
15 votes
2 answers
2k views

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 <escape> and C-[ apart in GUI ...
Kristóf Marussy's user avatar
14 votes
3 answers
5k views

What is the longest known key sequence in Emacs?

Qt supports Emacs-style keybindings, however for only up to four keys. To make a point why this limit should be increased it would be useful to show examples of Emacs-style keybindings with even more ...
wasamasa's user avatar
  • 22.2k
13 votes
3 answers
2k views

If I know a keybinding/shortcut, how to get the corresponding function?

I want to use the function to switch to other window when there are only 2 windows in emacs. I know that the shortcut is C-x o, but I don't know which function that shortcut calls. How do I ...
Daniel Wu's user avatar
  • 1,781
13 votes
3 answers
939 views

What is the select word/symbol function bound to <double-mouse-1>

I love the ability to select word/symbol at point which I currently do with double mouse click. I would like to be able to do it from the keyboard, and so I'd like to bind it to a keystroke (or maybe ...
Chip Grandits's user avatar
13 votes
1 answer
3k views

Using evil in the minibuffer

evil-mode does not seem to bind keys in the minibuffer. Is there a way to use evil in the minibuffer? It's hard to use Vim-style keybindings everywhere BUT the minibuffer.
Panch93's user avatar
  • 265
12 votes
9 answers
5k views

Typing quickly when Control, Alt and Esc are hard to reach

I'm very new to Emacs and I'm trying the built-in tutorial. After I went through the basics, I found it really hard to reach the Ctrl and Alt or Esc keys. I'm trying to type faster but since all the ...
anonymous's user avatar
  • 123
12 votes
4 answers
3k views

Org-Mode: How to create an "org mode markup" keybinding?

I know I can use *bold*, /italic/, _underline_, =verbatim=, ~code~, and +strike-through+ to apply markup to text in org-mode. But how do I create key bindings for applying these changes to a region of ...
modulitos's user avatar
  • 2,492
12 votes
1 answer
4k views

How to remap Company's select next and select previous keys?

I don't like the default M-n and M-p keys for company-select-next and company-select-previous so I was wondering if it's possible to remap those to C-n and C-p without affecting the mappings when ...
caisah's user avatar
  • 4,096
12 votes
5 answers
3k views

Problem "<dead-acute> is undefined" appearing when typing Greek stress ( ' )

I started using Emacs and I wrote a text in Greek. The problem is that the stress that is used upon some letters (ό, ύ, ί, ύ) doesn't work! It is usually inserted by pressing the ; (I mean by ...
Adam's user avatar
  • 2,467
12 votes
3 answers
6k views

For MacOS: how to bind left and right option keys separately?

Using Gnu Emacs in MacOS "El Capitan". Question: How do I bind the right option key to control but keep the left option key bound to option? Background: I found that even with caps_lock as ...
Ruby's user avatar
  • 345
12 votes
1 answer
835 views

decrease time until "C-x-" shows in echo area after pressing the keys

When I try enter commands via C-x, it takes 1-2 seconds until the echo area shows this prefix key, as C-x-. I'm quite new to Emacs, so this often confuses me, and I get lost. The ESC key acts ...
kai-dj's user avatar
  • 427
12 votes
2 answers
8k views

How to remap backward-delete and help command while using Emacs from a terminal emulator?

I was using Emacs on CentOS 7 from the MobaXterm terminal on Windows 7, but the backspace key instead of backward-deleting a character invokes the prefix command C-h. According to EmacsWiki, I tried ...
Joseph Tesfaye's user avatar
11 votes
2 answers
3k views

How to truly unbind ALL global keybinds?

I've just tried (set 'global-map (make-sparse-keymap)) but issuing C-hb still shows tons of crap, especially in the Global Bindings section: Global Bindings: key binding --- ...
Alexander Shukaev's user avatar
11 votes
2 answers
7k views

Open new window and switch to it

Assume I'm opening a new window with for example C-x 2 or C-x 3 then the buffer opens and I need to switch to it by hand with C-x o. Is there a build in solution to do this with one command? Or even ...
daeda's user avatar
  • 439
11 votes
5 answers
3k views

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 ...
Chakravarthy Raghunandan's user avatar
11 votes
3 answers
8k views

How to bind key in use-package

I added a section binding to my config, but one key doesn't work. :bind (("C-c a" . org-agenda) ("<f6>" . org-capture) ("<M-S-return>" . org-...
dmin's user avatar
  • 373
11 votes
1 answer
1k views

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's user avatar
  • 667
11 votes
2 answers
1k views

Strange behaviour on evil-delete

When I use Emacs with Evil mode for some time, I sometimes get to a point, where I have no choice to what I want to delete when pressing d (or calling evil-delete). The current line gets deleted ...
Michael Dahl's user avatar

1
2 3 4 5
29