Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [key-bindings]

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

58
votes
3answers
6k 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 ...
54
votes
17answers
26k 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 ...
34
votes
4answers
7k 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 ...
27
votes
3answers
5k 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, ...
27
votes
4answers
4k 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 ...
24
votes
6answers
9k 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?
24
votes
4answers
4k 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 ...
24
votes
3answers
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 ...
20
votes
2answers
340 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 (...
19
votes
7answers
1k 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 ...
19
votes
1answer
2k 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 ...
16
votes
1answer
676 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, ...
16
votes
2answers
4k 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 ...
14
votes
3answers
4k 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 ...
14
votes
2answers
920 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 ...
14
votes
1answer
2k 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?
14
votes
4answers
2k 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 ...
14
votes
1answer
1k 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: (...
13
votes
4answers
403 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 ...
12
votes
1answer
483 views

changing the role of the underline and the minus-sign just in LateX-mode

During the work with tex files with auctex+emacs (LateX-mode), I use more frequently _ (underline) instead of - (minus sign). The same as ^ instead of 6. The inconvenience is that I should press more ...
12
votes
2answers
1k 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 ...
11
votes
7answers
2k 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 ...
11
votes
8answers
2k 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 ...
11
votes
3answers
2k 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.)
11
votes
1answer
771 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?
11
votes
3answers
324 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 ...
11
votes
2answers
243 views

Use two major-mode-maps in the same buffer

I've run into a few situations where it would be highly convenient to have to have the keymap of one major-mode act as a fallback keymap for another major-mode. For instance: I write a lot of LaTeX ...
11
votes
1answer
861 views

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, ...
11
votes
1answer
743 views

How to bind C-[ for real (seriously for real this time)

Is there any way to bind C-[ to something and not have all M- (Meta) bindings messed up? Not the first time this question comes up. Unfortunately, the only solution offered in the previous thread is ...
10
votes
1answer
2k 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 ...
10
votes
2answers
1k 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-...
10
votes
1answer
410 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 ...
10
votes
2answers
694 views

Convert a normal key into a modifier key

I have a keyboard which, for some inexplicable reason, features a key that sends the Danish Dollar symbol to OS X - §. With shift it sends the plus/minus symbol - ±. Is it possible within Emacs to ...
9
votes
3answers
521 views

Keep moving to the end of lines

The default of key binding C-a/C-e is only for one thing, move to the beginning/end of the line, is there any package that can make Emacs act like this: If I'm not at the end of a line, C-e will go ...
9
votes
3answers
1k 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 ...
9
votes
4answers
414 views

Which keyboard shortcut to use for navigating out of a string

When I'm in the middle of a looooong string, like the following (setq Emacs-beta "Which keyboard shortcut to use for navigating out of a string") Can I skip out of it, just before the first " (after ...
9
votes
1answer
483 views

How can I go from a key 'code' back to its keyboard equivalency?

I have the following documentation: mc/keymap is a variable defined in `multiple-cursors-core.el'. Its value is (keymap (67108903 . mc-hide-unmatched-lines-mode) (27 keymap (118 . mc/cycle-...
9
votes
1answer
254 views

Using function keys as “sticky” modifier keys

Is there a way to use a function key (like <f8>) as a sort of super-key-down event and then have the next keystroke (f.ex. s) then be interpeted as s-s? In other words, this will be similar to ...
9
votes
1answer
688 views

How to get keystrokes displayed in the echo area immediately?

How do I get keystrokes displayed in the echo area immediately? For example: when I enter the key sequence C-u j, it will not display in the echo area immediately, but then I press key k, and I ...
9
votes
2answers
280 views

What might be unused keys on Emacs that generally can be used to bind keyboard macros?

I read that the usual way to bind key to keyboard macros are C-x C-k 0 to 9 and A to Z. So for example, after we define a keyboard macro, we can type C-x C-k b and Emacs will ask for a key to bind. ...
9
votes
1answer
3k views

How do I set up key bindings for modes in a specific Evil state?

I have a set of key bindings that I use for both web-mode and php-mode in insert mode (of Evil). So I cannot use set-local-map or something. Because in normal mode, the same keys will then call other ...
9
votes
3answers
2k 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?
9
votes
2answers
176 views

How to avoid typing “space” after “^” for moving up in directory in dired?

^ is the key binding for moving to the parent directory in dired ("Up directory"). However, in Gnu Emacs on Windows 7 Professional 64-bit with my German keyboard layout, it is not sufficient to type "...
9
votes
4answers
1k 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 ...
9
votes
2answers
144 views

Is there a standard/recommended syntax for defining a keyboard binding?

I have seen all of the following for defining a keyboard binding. All of these work (at least on MS Windows). I don't know if there is another way to do the same thing. I am wondering if there is a ...
9
votes
1answer
211 views

How to navigate most efficiently to the start or end of the main text of an org headline?

It's easy to navigate quickly from the start of one org-mode headline to another using speed keys. Suppose now I'm at the start of a headline, and I want to add to the main text, in the beginning ...
9
votes
1answer
551 views

why doesn't emacs support key up/down events

AFAIK emacs does not support keyup/keydown events, only keypressed. An example of a consequence is that when we want to mark a region we have to first set a mark set-mark-command and can then mark the ...
8
votes
4answers
2k views

How to bind your keys to keymaps that aren't loaded yet?

I use use-package to manage installed packages and bind-key to assign actions to custom keys that I like. I override most of the default Emacs keybinding (e.g. C-n becomes M-k, C-p becomes M-i), but ...
8
votes
2answers
1k 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 --- ...
8
votes
2answers
2k views

Use standard keybindings for copy, paste, cut, etc. as in other software?

I want to use the same basic keybindings for copy (C-c), paste (C-v), cut (C-x), etc. that are supported in some other software. How can I do that?