Questions tagged [key-bindings]

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

196 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
0 answers
538 views

Detect keyboard layout?

Q: how can I detect the keyboard layout from Emacs? I'm writing some code that will set keybindings dynamically by selecting easy-to-reach keys (eg, those on home row). To do this, though, I need to ...
  • 32.1k
5 votes
1 answer
243 views

Forcing keys to run emacs commands instead of other app's commands

I am using Mac OS X Yosemite if this matters at all. Is there a way, while in the emacs GUI, to force every key combination to run the emacs command specified by this key binding instead of other ...
  • 201
4 votes
0 answers
269 views

How to make Emacs not intercept Command-Ctrl-Space, used for Special Characters on macOS?

On macOS the CommandCtrlSpace shortcut opens an Emoji picker which can be expanded into a Special Characters picker. But when I type this shortcut on Emacs in order to input a character, instead of ...
  • 360
4 votes
1 answer
3k views

How to assign TAB to indentation and to yasnippet expand key

i'm trying to have the key TAB to: Indent my code (like in any other text editor) Trigger Yasnippet I have theses lines in my config: (global-set-key (kbd "TAB") 'yas-expand) (global-set-key (kbd "...
  • 51
4 votes
0 answers
1k views

Why can't I remap the laptop fn key modifier?

I've remapped the laptop key fn to Hyper using: (setq ns-function-modifier 'hyper) to scroll other window I set (global-set-key (kbd "H-n") 'scroll-other-window) (global-set-key (kbd "H-p" ) '...
  • 5,493
3 votes
0 answers
20 views

Look up the key bound to a definition in a specific keymap, ignoring indirect bindings

How can I look up what key(s) are bound to a particular definition in a keymap? Basically the converse of lookup-key. where-is-internal is almost the answer I'm looking for, but it doesn't seem to ...
3 votes
0 answers
883 views

Remapping keys in org mode agenda view

I currently trying to remap my org mode agenda keymap in Spacemacs for org-agenda-next-item and org-agenda-previous-item. In the agenda view I like to map the functions to k for next-line and l for ...
  • 31
3 votes
0 answers
3k views

Meta key in Mac for Emacs

I have been working with GNU emacs on a Linux server but my keyboard is for mac. I have a problem with defining the alt key as meta. tried (setq mac-command-modifier 'meta) in ~/.emacs.el and then ...
  • 131
3 votes
0 answers
320 views

how can i thoroughly change (key "C-x") in ivy-minibuffer-map?

one thing very interesting, i tried to (define-key ivy-minibuffer-map (kbd "C-x") 'ivy-kill-line) ..well then i restart my emacs, the first time i use the ivy to complete something, i type C-x ...
  • 111
3 votes
0 answers
69 views

Preferring org-cycle to yas-expand when hitting tab

If both org-mode and yasnippet are active, tab will expand a snippet if possible and otherwise execute org-cycle. Is it possible to reverse this priority? org mode version: 9.0.9. yasnippet version: ...
  • 3,094
3 votes
0 answers
221 views

How to disable/ignore all key-bindings for a file-formats mode?

There are some file-type modes I mainly use for syntax highlighting (some other features may be handy - eldoc for example), however when loaded they add key-bindings that override my existing bindings....
  • 7,979
3 votes
0 answers
201 views

How to ignore Caps Lock state for keyboard shortcuts?

When Caps Lock is on, typing commands may bring surprising results, because the capital letters are used instead of what has been intended. In some modes it leads to deleting large chunks of texts, ...
3 votes
0 answers
921 views

How to disable the map from esc to meta?

I installed the oh-my-emacs configuration and try to use emacs in the terminal. oh-my-emacs configuration enables evil-mode in default, and my problem is that, I found esc is mapped to meta, while ...
2 votes
0 answers
40 views

How do I completely re-define the menubar in 28.2

I have been using XEmacs for years and have completely redefined the menubar for my productivity. I would like to replace XEmacs with Emacs 28.2. I have tried several ways to redefine some menubar ...
2 votes
1 answer
60 views

Binding several keys to one yasnippet

Suppose we have a snippet for sql mode: # -*- mode: snippet -*- # name: select * # key: sel # -- SELECT ${1:*} FROM $2; Sometimes I forget to switch the keyboard layout and type Russian "ыуд&...
  • 957
2 votes
3 answers
838 views

How can I rebind keys in pdf-mode, using Doom?

I'm really struggling to remap some keys in pdf-view-mode. This is what I have so far: ;; Unbind keys; see https://github.com/hlissner/doom-emacs/blob/develop/docs/faq.org#my-new-keybinds-dont-work (...
  • 517
2 votes
0 answers
69 views

Dealing with aggressive desktop environments

I use Emacs on Linux systems. Nowadays most programs don't use modifiers, except for a few Ctrl-something (e.g., Ctrl-B toggles bold characters practically everywhere), so developers of modern desktop ...
  • 564
2 votes
0 answers
79 views

Keybindigs conflict between minor modes

The configuration that I have for python mode implies loading both elpy.el and python.el. The things is that I found the python.el keybindings more natural than the elpy.el ones. And most of the ...
2 votes
0 answers
40 views

Get keymap that called function

I am trying to write a function that can be used to make a keybinding "remember" the key sequence that led up to the function being called. (defun modal-function (func) (funcall func) (set-...
2 votes
2 answers
579 views

Show Link Tooltip mouse over with keystroke

When I use mouse-over on an Link (thanks to Tobias) it shows an Image and text. When I used display-local-help the image disappeared (perhaps due to lack of space in the message area). I want to ...
  • 21
2 votes
0 answers
28 views

How to reliably redefine scroll wheel in isearch? [I'm using Mitsuharu Yamamoto's Mac port]

I decided to define <wheel-up> and <wheel-down> to isearch-repeat-forward and isearch-repeat-backward in the isearch-mode-map. This works, but if you scroll quickly, it reverts to ...
  • 810
2 votes
2 answers
297 views

How does one set input-decode-map on GUI frames in emacsclient?

I'm trying to adjust bindings in input-decode-map (to distinguish C-m and RET in GUI mode). None of the advice given on Stack Overflow, gnu.emacs.help, Reddit, or Super User seems to work. I ended ...
  • 3,894
2 votes
0 answers
41 views

Record Emacs interactive function invocations

I want to optimize my keybindings, in a way that the more a command invoked interactively, the more accessible will be a key-binding for it. Is there a way to record all interactive function ...
  • 918
2 votes
0 answers
257 views

Key bindings are not recognized with non-Latin keyboard layouts on Ubuntu

A lot of times I have to change the input language of the keyboard (from English to a different one) causing the problem of the Emacs commands to not be recognized. Normally when you press Ctrl+A you ...
  • 2,397
2 votes
0 answers
309 views

Dead keys not working in Emacs OSX

I created a custom keyboard layout (using ukelele) where I use F1-F4 as dead keys to input pinyin (accents for tones). Is there a way to get it to work in emacs? I tried the (require 'iso-transl) but ...
2 votes
0 answers
863 views

`which-key` displays "lambda" when key binding bound to lambda expression

I'm using the which key plugin in my emacs setup and I notice that when I set a key binding in a keymap with a lambda expression, like this (define-key my-yank-keymap "l" (lambda () &...
  • 501
2 votes
0 answers
362 views

Equivalent to vim's nnoremap?

Just began transitioning from vim to spacemacs and I can't find a way to define keymappings such as this: nnoremap N Nzz I tried defining it like this: define-key evil-normal-state-map (kbd "N") (...
  • 21
2 votes
0 answers
95 views

using prefix binding along with Key-chord binding

I am using my capslock key as a prefix key and have already set "capslock-v" to 'helm-show-kill-ring. This however does not work with copying outside code into emacs so now I want a set up as such: ...
  • 77
2 votes
0 answers
563 views

Pressing both Ctrl keys at the same time is recognized as Ctrl plus Meta

When pressing both C at the same time, the combination is recognized as C-M on a Win7 machine and Emacs 24.5. I've stumbled on this by mistake while pressing C-C-SPC. While on a Linux machine, this ...
  • 301
2 votes
0 answers
277 views

Trace Evil-mode commands

At the moment, I only know one way to determine which Emacs functions are called by any given Evil command (e.g. a sequence of key bindings in the Normal state): read the Evil source code. Is there a ...
user avatar
2 votes
0 answers
196 views

How to bind a keycode to hyper key in Aquamacs

I am using Aquamacs. I have used Seil to change my caps lock key to emit key code 110. I would like to bind that code to super/hyper/another modifier so that I can create more key combinations. How ...
  • 191
2 votes
0 answers
101 views

Is it possible to use the mouse wheel for company mode?

I'm using the Cocoa version of Emacs. When company mode presents a list of completions you can use the mouse to select one. It would seem natural to be able to use the mouse wheel to scroll through ...
  • 1,581
1 vote
0 answers
26 views

What is Emacs <select> key?

I'm running Emacs 27.2 inside Ubuntu 16.04 in terminal mode inside a Bash version 4.3.48 shell. Normally the describe-key for the end keyboard key shows that it's <end>. However, when Emacs is ...
  • 724
1 vote
0 answers
26 views

Stop translating M- commands to lower case?

In order to for me to be able to use meta + shift + v as a keybinding, I have to tell emacs to pass (kbd "M-V") to global-set-key - if I try and use (kbd "M-S-v") then this ignored,...
1 vote
2 answers
81 views

(Un-)bind keys for org-agenda in use-package

I want to unbind some keys in the org agenda display with use-package. I did the following: (use-package org :ensure t :pin gnu :config (define-key org-agenda-mode-map (kbd "<C-S-right&...
1 vote
1 answer
111 views

How to create/use extra modifier keys or get a similar functionality to modifier keys?

I want C-d to act as a kind of modifier for the <left> and <right> arrow keys in a similar way to how Shift is a modifier that allows letters to be capitalized. Shift Analogy When I press ...
  • 111
1 vote
0 answers
42 views

Key Binding not Working

I have the following code as shown below for my .emacs file. For some reason the keybinding is not working nor are the extensions for deft I am pretty sure. Does anybody know why this is? (require '...
1 vote
0 answers
240 views

Windows Terminal (WSL2) and M-S, C-S in Org Mode

UPDATE: I just tested emacs -nw with the MSYS2 terminal (Windows) and with iTerm (macOS) and they all have the same problem. emacs -nw on WSL2 with the Windows Terminal has many known issues with key-...
1 vote
1 answer
81 views

Why does a code block that contains only comments seem to change key bindings?

This is very odd. I have my Emacs config in code blocks in an org-mode file that is called from my init file using (org-babel-load-file "~/.emacs.d/emacs-config.org"). I've tried to assign ...
  • 38
1 vote
0 answers
41 views

How can I change buffer local key binding C-h, C-x, M-x in term raw mode?

I'm running a specific console application in a term window (char/raw mode). This application has no need for C-h, C-x, and M-x, so they should just do what they always do in Emacs. However, I don't ...
  • 21
1 vote
0 answers
83 views

isend: Why additional C-RET required when sending code to ansi-term?

The following code (from here) allows to send lines of code to an open *ansi-term* buffer via C-RET. It works well but the very first time I hit C-RET, the current line is not sent (nothing happens). ...
1 vote
0 answers
53 views

Using define-word

I want to use dictionary on emacs and found define-word. I downloaded it and wrote the following setting in init.el. But, I can't use this and any word return 0 definitions found. Are other settings ...
  • 101
1 vote
0 answers
37 views

How can I get Emacs 21-style file-name completion in GNU Emacs 25.1.1?

How can I make file-name completion in GNU Emacs 25.1.1 act like it did in version 21.x.x? There are a few things that bother me: The *Completions* buffer opens up in a custom fit-to-content window. ...
  • 11
1 vote
0 answers
37 views

On installing a handler for SIGUSR1

The documentation quoted in this answer mentions two different way of installing a handler for a SIGUSR1 signal, namely: (define-key special-event-map [sigusr1] 'sigusr1-handler) and (global-set-key [...
  • 3,105
1 vote
2 answers
237 views

Bind function key when in python-mode

I want to bind f5 to launch pdb, but the minibuffer always says <f5> is undefined. (use-package python-mode :bind (:map python-mode-map ("<[f5]>" . realgud:pdb)) :...
1 vote
0 answers
20 views

Mac OS and possibly other GUIs: Why is default "s-g" behaving differently from "C-s" in isearch-mode

I don't really want s-g to exit the Isearch minor mode but it does. The reason this is happening to me is unclear, because investigation of the binding of s-g reveals it is supposed to be a standard ...
  • 63
1 vote
1 answer
188 views

mwheel-scroll bindings between GUI and terminal?

Using an Emacs daemon (28, pgtk branch) switching between GUI and terminal, I can't get mouse scrolling to work on both. They work on each individually, but the issue is with the mouse-wheel-{up,down}-...
  • 11
1 vote
0 answers
1k views

Adding a custom keybinding in Doom Emacs

I am using evil-mode and am very new to emacs and doom. How would I be able to map Ctrl-s to :w or save. Also, how would I be able to bind Ctrl-n to neotree-toggle? I have been searching and trying ...
1 vote
0 answers
54 views

How to specify that a package uses my key bindings

For example, I use M-s as isearch-forward: (global-set-key (kbd "M-s") 'isearch-forward) When I try to install isearch+ with use-package: (use-package isearch+ :straight t) I get the ...
  • 308
1 vote
1 answer
997 views

Can I use Right Alt/Ctrl Keys as Alt/Super/Hyper modifier keys of Emacs in Windows 10?

I noticed that I've rarely used Right Control Key and Right Alt Key in my keyboard, so I'm wondering if I can use them as Alt/Super/Hyper modifier key in Emacs. Is such a thing possible in Windows 10? ...
  • 184