Questions tagged [key-bindings]
Keyboard shortcuts, key chords, key sequences, hotkeys, or any association between key combinations and corresponding actions in Emacs.
202 questions with no upvoted or accepted answers
6
votes
0
answers
597
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 ...
5
votes
1
answer
286
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 ...
4
votes
0
answers
5k
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 ...
4
votes
0
answers
313
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 ...
4
votes
0
answers
97
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: ...
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" ) '...
3
votes
0
answers
29
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
1k
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 ...
3
votes
0
answers
385
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 ...
3
votes
0
answers
244
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....
3
votes
0
answers
1k
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 ()
&...
3
votes
0
answers
212
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
1k
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
1
answer
125
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
0
answers
54
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. ...
2
votes
0
answers
96
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 ...
2
votes
0
answers
229
views
Autocomplete when editing file links
When I insert a link into an org-file using C-c C-l (Doom Emacs, if that matters) and select file:, it show me the files in the current directory to autocomplete from. However, when editing such a ...
2
votes
0
answers
167
views
Replace normal state keymap in Evil with another
I don't like Evil collections or the Evil keybindings in the dired-mode. I would like to re-map only few keys in the normal state like j, k, and a few more keys with g prefix and I would like to keep ...
2
votes
0
answers
110
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
138
views
unbind ALL C-x and C-c shortcuts in org-mode with CUA-mode
For a special purpose application of emacs with org-mode I want to dramatically simplify the shortcuts. I'm already quite satisfied with my config based on CUA mode.
The one thing that bothers me ...
2
votes
0
answers
44
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
671
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 ...
2
votes
0
answers
34
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 ...
2
votes
0
answers
310
views
How to get hungry-delete working in paredit-mode?
Using hungry-delete is really nice, see this Blog post. But with paredit activated, hungry-delete functions are not triggered.
paredit defines <delete> as paredit-forward-delete and DEL as ...
2
votes
0
answers
45
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 ...
2
votes
0
answers
318
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
votes
0
answers
341
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
403
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") (...
2
votes
0
answers
104
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:
...
2
votes
0
answers
576
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 ...
2
votes
0
answers
284
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 ...
2
votes
0
answers
203
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 ...
2
votes
0
answers
113
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 ...
2
votes
1
answer
318
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 ...
1
vote
1
answer
77
views
Avy keybindings
I would like to define keybindings for avy - more precisely, let's say I call one of the avy-goto-... functions, now these all expect a character. I would like to be able to have a keybinding (e.g M-' ...
1
vote
0
answers
79
views
Why can't I ignore the right Meta key in Emacs 29.1 on MacOS?
I'm using GNU Emacs for MacOSX 29.1 under macOS Ventura, & I need to enter accented letters (é, à, &c.). Following the manual, wiki, & several articles, I used
(setq ns-alternate-modifier '...
1
vote
2
answers
120
views
How to create a general and specific key binding
How do I bind a key for general use, but differently for a specific mode, such as dired?
eg how would I resolve this?
(define-key dired-mode-map (kbd F12) #'dired-up-directory)
(global-set-key (kbd ...
1
vote
0
answers
163
views
Prefix key in general package does not work with emacs start up page (fundamental mode)
I am trying to define key bindings with general.el following emacs from scratch. However, the leader-prefix key (SPC) does not seem to work from the Emacs start-up page (Fundamental mode). It works ...
1
vote
0
answers
65
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 ...
1
vote
0
answers
37
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
0
answers
132
views
How can I temporarily disable all (other) key bindings?
How can I write a command, and bind it to a key, so that when invoked it disables all key bindings other than the current key, until that same key binding is pressed again?
The goal is to facilitate ...
1
vote
0
answers
53
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
582
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
0
answers
53
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 ...
1
vote
0
answers
86
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
60
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 ...
1
vote
0
answers
903
views
TAB in Emacs doesn't work properly
My tab key in emacs behaves as follows:
Instead of inserting a tab, it now removes all leading spaces of the line:
Test Line
After pressing the tab key at any position of the line:
Test Line
...
1
vote
2
answers
433
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
21
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 ...
1
vote
1
answer
392
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}-...