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.

1
vote
1answer
55 views

Binding a key to (MAP . CHAR)?

According to the define-key docstring, binding a key to a cons (MAP . CHAR) should cause that key to act as CHAR in MAP. However, I cannot get this to work. For example, evaling this and trying to use ...
2
votes
1answer
136 views

How to use M-O on Emacs in terminal?

I bind M-o to next-word, and want to use M-O to shift-select next word. M-O works well on Emacs GUI app on Mac, but not on Emacs in a terminal. The reason is: In the terminal, up-arrow is encoded as ...
1
vote
0answers
29 views

How to graphically represent Meta characters

Given that the variable x contains the numeric representation of the key "Control-Z", say (setq x ?\C-z), one may graphically represent its contents by issuing the command (char-to-string x), ...
1
vote
2answers
233 views

Returning to the parent hydra

I'm looking for a way to return to the parent hydra after using certain commands. In this example (defhydra hydra-a (:color teal) "a" ("b" (progn (hydra-b/body) (hydra-push '(...
0
votes
2answers
170 views

Dump list of current keybindings to standard out?

I like emacs, I like keybindings. I also like the command line and have a lot of keybindings. Is it possible to dump emacs keybindings to standard out so that I can search them with things like grep? ...
0
votes
1answer
304 views

How do I bind keys using general.el alongside evil?

My goal is to bind SPC SPC to counsel-M-x. I've tried using this snippet from this post (use-package general :ensure t :config (general-evil-setup t) (general-define-key :states '(normal visual ...
3
votes
1answer
181 views

More convenient auto-completion using ivy

I have the following lines in ~/.emacs: (require 'counsel) (with-eval-after-load 'org (define-key org-mode-map (kbd "C-c C-c") #'counsel-org-tag)) (with-eval-after-load 'org-agenda (define-key ...
1
vote
2answers
61 views

How can I define a key to cancel selection only when I selecting something?

How can I define a key to cancel selection only when I'm selecting something? Because I use this key to do other thing in global-mode-map.. Is there any specific mode for mark and selecting something?...
3
votes
2answers
152 views

How to use describe-key in Helm results buffer?

While in the results buffer of helm-projectile-grep, I know I can use C-<up> and C-<down> to visit the files with the matches, but I would like to rebind those keys. Normally I would use ...
2
votes
1answer
44 views

Determine whether a given keybinding is the default

I'm curious if there is a mechanism for determining whether a keybinding is a stock (default) keybinding within Emacs (or a particular package). Whenever I mention a command to someone I generally ...
5
votes
2answers
201 views

Keybinding for buffer word count

The following in my .emacs file does not produced the desired result of showing me the word count for the current buffer (it "does nothing"): (global-set-key (kbd "<f9>") (kbd "C-u M-=")) Is ...
1
vote
1answer
92 views

Use xcape-like Control_L=Escape only in Emacs evil insert-mode?

I like the idea of xcape for exiting insert-mode by just quickly tapping Control_L, but I don't like how it leaves "unconsumed" escapes around in other modes, or in other programs/terminals, which ...
1
vote
1answer
975 views

C-x C-f results in the error message: “Wrong type argument: commandp, counsel-find-file”

I opened Emacs, and executed C-x C-f. A beep sounded and the following message appeared in the status line: Wrong type argument: commandp, counsel-find-file All I wanted was to open an existing file....
3
votes
1answer
106 views

Change keybindings on buffer switch

I'm a new emacs user so its possible that I've misunderstood something. I'm looking for a function that automatically changes my current keybindings depending on the current major mode. My approach ...
4
votes
1answer
2k views

Wrong number of arguments on lambda key binding

I am not able to figure out what is wrong in this elisp form: (define-key ggtags-mode-map (kbd "M-.") (lambda () (interactive) (ggtags-find-tag-dwim) (recenter))) I keep getting this ...
3
votes
2answers
74 views

Convert bitmap vector keys into a human readable string

If you run (kbd "M-r") you'll get back the bit vector [134217842]. But what if I want to go the other way around: start with [134217842] and return M-r. How does one do that? I Have looked at the ...
0
votes
0answers
44 views

Emacs configurations samples

I am starting over with emacs after a long time and installed GNU OSX (https://emacsformacosx.com/). I was configuring it for key strokes and themes and was wondering if there are samples out there ...
1
vote
0answers
62 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 ...
1
vote
1answer
61 views

How to disable icicles integration with helm?

Long time ago I updated Helm and it replaced normal Icicles behaviour for choosing files. I had icicles bound to C-x C-f: C-x C-f runs the command icicle-file, which is an interactive Lisp function ...
6
votes
1answer
367 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.
0
votes
0answers
137 views

Spacemacs menu in mini-buffer displays Dired+ “C-x D A” command unreliably

Two weeks ago I installed Dired+. I successfully used Dired+ C-x D A (diredp-add-to-dired-buffer) command. But the Dired+ C-x D A command is not always available. Sometimes after C-x, the D appears ...
1
vote
3answers
387 views

Disabling arrow keys in Emacs EVIL Mode

I wanted to disable arrow keys in my Emacs to practice vim key bindings using EVIL mode. So instead of using global-unset-key as someone here on stackexchange suggested. I used the following code in ...
0
votes
1answer
82 views

Cannot define keybinding in markdown-mode

I'm trying to use the package checkbox together with markdown-mode. The checkbox documentation gives the following example on how to define a global keybinding for it's functionality: I'd recommend ...
4
votes
1answer
817 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 ...
0
votes
0answers
35 views

how to bind a function to Shfit key?

I tried (global-set-key (kbd "S") 'left-char) and use describe-fuction to see whether sucessed or not,it did. but when I just press Shift key,nothing happened,how to make it happen?does it have ...
2
votes
1answer
69 views

Proper way to provide a default optional parameter

I like doing PR reviews with Magit's diff, thus calling magit-diff-visit-file pretty often, providing a universal argument for the optional other-window parameter. To optimize the process instead of ...
0
votes
2answers
1k views

In Spacemacs, how to customize keybindings that are condition on language file?

Here is what I would like to do. I would like to customize key bindings that point to a different command depending on the file type on which the user is operating. For instance, if one presses f5 in ...
0
votes
0answers
116 views

How can I disable the M-h keybinding in org-mode with evil-mode?

The problem seems to be that evil-mode translates the key chord M-<left> into M-h. Unsetting M-h by binding it to nil in the local, global or org-mode map in a org-mode hook does not help.
0
votes
1answer
458 views

spacemacs: how to unset the keybinding of undo with 'u'

I don't want to have key 'u' bound to undo-tree-undo, as it's too conveniently dangerous to confuse with u for universal argument prefix. I tried (global-unset-key "u") But it didn't have any ...
1
vote
1answer
104 views

Is there a key binding to open the configuration file of Emacs?

I'm going to set key binding to open and edit my init.el. Hotkey will call this function. (defun my-edit-configuration () "Open the init file." (interactive) (find-file user-init-file)) I ...
2
votes
1answer
199 views

Mapping AltGr+t key as a Ctrl+x (How to use AltGr key effectively in Emacs)

I am using international keyboard and extensively use AltGr key. There are many unused keys with AltGr so I would like to map AltGr+t = Crtl+x. I don't want to remap AltGr to Crtl; I just want to use ...
1
vote
1answer
225 views

How to set the keybinding for addind the hash symbol (#) in spacemacs with MacOS and an UK keyboard

I'm using spacemacs on a Mac OS X laptop with a UK keyboard and I want to be able to use Alt-3 (M-3) to insert the hash symbol #. I tried to add this function that I found on this SO answer without ...
0
votes
1answer
220 views

Auctex key-bindings for easy saving, compilation and viewing.

I am new to Auctex and Emacs. Previously I have been using vim-latex in which the key bindings are easy. For example, I was using Ctrl-Space in Vim to to save the tex file, compile the document and ...
0
votes
0answers
38 views

Send sequence of keys - Navigation (e.g. C-f) works, everything else fails

Question rephrased. old version of the question below... I can bind key sequences to hotkeys like this: (global-set-key (kbd "C-x C-x") (kbd "C-n C-b")) when pressing C-x C-x the cursor moves down ...
2
votes
2answers
535 views

Spacemacs: How do I set a key in anaconda-mode?

I'm using the python-layer and am trying to set M-r to run replace-string while editing Python files. I've tried all of the options below from inside the function dotspacemacs/user-config. Help? ;; ...
2
votes
0answers
16 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 ...
1
vote
1answer
95 views

Bind keys differently when in any minibuffer

I normally use my keypad numbers to perform various navigation commands, but one of those commands is goto-line, and when I'm in the minibuffer entering the line number, I want my keypad to run self-...
1
vote
1answer
73 views

Command abbreviation

After running M-x magit-status Emacs provided me this suggestion in the mini-buffer: You can run the command ‘magit-status’ with M-x m-stat RET Is this a built-in feature of emacs? If not, does ...
1
vote
1answer
140 views

Why does Emacs use C-a for moving to the beginning of a line (home)?

I am making a tutorial about Emacs and do not know how to explain the reason why C-a is chosen as the keyboard to move the cursor to the beginning of a line? Everything with C-b, C-f, C-n, C-p, C-e ...
0
votes
1answer
97 views

How to change/remove an existing but unneeded keybinding? [duplicate]

Some of the packages I use define keybindings that I want to overwrite or remove. How do I overwrite/remove these keybindings? For example, I use ace-window and speedbar together. ace-window uses M-...
2
votes
0answers
120 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 ...
1
vote
1answer
35 views

M-w breaks intermittently on Windows 10

M-w stops working randomly on my Windows 10, which I believe is the same issue described here. Unfortunately no solutions can be found. To sum up: M is mapped to Alt The problem occurs to ALL Emacs ...
2
votes
1answer
227 views

Evil and org-mode keybinding 't' conflict

In Spacemacs with evil and org-mode, the letter 't' is assigned to two functions: org-todo (don't need this because I use shift-arrow to cycle through todo states) evil-find-char-to (I need this) ...
0
votes
0answers
107 views

How can the ace-window hotkey be set to work in sr-speedbar?

I have configured the M-p key to trigger ace-window, but when I navigate to the sr-speedbar window it stops working and I have to use C-x o to move out. Is there some mode hook I have to use to ensure ...
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 ...
1
vote
1answer
42 views

Key assignments in init file issue

I am customizing emacs X11 on a Linux box. By default, C-x C-s is bound to save-buffer, and C-x C-s shows as the keyboard shortcut in the File->Save menu. If I put into my .emacs file the following ...
2
votes
1answer
136 views

Define a customizable (defcustom) key binding

I want to allow the user to redefine key bindings for the interactive commands in a major mode. I tried putting them in strings, but I can't get the customized variable value in my mode-map. Here's ...
2
votes
0answers
47 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: ...
0
votes
1answer
122 views

describe-bindings not working as expected

Spacemacs Help SPC h d b (describe-bindings) is not working as expected. I type SPC h d b, and then enter the bindings: SPC f e d not listed in the minibuffer, but the binding works SPC f e R not ...
7
votes
2answers
1k 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 ...