As mentioned by @YoungFrog in the comments, starting with Emacs 25.1, the good-old C-h k method of describing key-binds will also tell you which keymap the key was found in.
Before Emacs 25
There’s some code
on this, but it’s incomplete as it does not cover everything. Below is an improved version of it.
Keys can be bound in 9(!) ways. ...
C-h b will list all the bindings available in a buffer. This is a mnemonic for help (C-h) bindings (b).
You can also get a list of keybindings via C-h m, which is help for the major and minor modes for the buffer. The formatting of this is a little clearer, but includes additional information about the modes beyond just listing the keybindings.
There is ido mode that should help.
put this in your init file, to activate ido mode by default:
Now, C-x b will show you a list of candidates.
Put this in your init file, if you prefer the items being displayed vertically:
(setq ido-separator "\n")
Courtesy of ergoemacs
Let me also suggest this post talking about switch to ...
I've recently started using C-x <left> and C-x <right>. Those are both standard Emacs bindings—nothing to configure. Left takes you back to the previous buffer (initially the same as C-x b RET) but doing it again takes you to the 3rd most recently visited buffer. If you're popping back and forth between 3 or 4 buffers a lot then I find it a lot ...
There is a "shortcut" approach too for the same solution if you don't want to define your own minor mode (that I talk about in my first answer).
You can install the use-package package available from Melpa and make use of bind-key* or bind-keys* macro that's part of the bind-key package that ships with use-package.
From the documentation of bind-key.el:
In Shift+Up isn't recognized by Emacs in a terminal I explain how terminals translate most function keys into escape sequences, because the interface between applications and terminals transmits characters (or rather bytes), not keys. Only a few modifier+character combinations have their own character:
Ctrl plus a letter or one of @[\]^_ turns into ...
You can define your own minor mode and its key map and have that override all other modes (minor + major). That's exactly why I chose to write my own minor mode.
Steps to have your key bindings override all bindings:
Defining your own minor mode and key map as shown below.
Activate your minor mode globally
(define-key my-mode-map (kbd "C-j") #'newline-and-...
I use the command helm-descbinds, which is available via melpa. I mapped it to C-h b because it is basically a drop-in replacement for describe-bindings. The benefit is that it is easier to navigate and search than the output of describe-bindings because you can easily search for keywords and the helm buffer will narrow to show all of the matches, and ...
Check out the free-keys package, which gives you a function of the same name that shows you all your currently unused key-bindings.
bind-key is also a helpful tool which gives you a cleaner syntax for defining your own bindings, i.e.:
(bind-key "C-h C-k" 'free-keys)
bind-key also comes with a handy defun called describe-personal-keybindings to see all the ...
You can feed arbitrary events (keystrokes, mouse clicks, etc.) to the command loop by putting them onto unread-command-events. For example, the following will cause the command loop to execute a break the next time it is run:
(setq unread-command-events (listify-key-sequence "\C-g"))
Note that this only feeds events to the command loop, so it will do ...
The future is long gone, and the stone age of computing is just about to come. All text terminals I know still send the exact same byte-sequence to Emacs for C-i as for TAB, so the original need to "unify" them is still very much with us.
The input-decode-map (à la (define-key input-decode-map "\C-i" [C-i])) is probably about as good as it gets right now.
I tested with the following script,
(when (commandp sym)
(let ((where (where-is-internal sym nil nil t)))
(setq keyseqs (append keyseqs where)))))))
(lambda (a b) (< (length b) (length a))))))
This is a hard question to "answer", but a few thoughts:
Try working with the default key bindings for a while, because Emacs will definitely feel strange at first. I would not suggest making major configuration changes until you have a better sense of what works and doesn't work for you.
You'll find Emacs users on both sides of the caps-lock vs. ctrl ...
If you are talking about binding keys for your own use, then this is the rule: You can bind any keys you like.
If you want to be sure not to bind a key that might already be bound then use C-c followed by a letter. All such keys are reserved for users (see next).
If you are talking about binding keys in code (e.g., a library) that you write, for use by ...
You will be more comfortable in an X11 Emacs, which can receive keyboard input and display text without going through encoding and decoding for the terminal. The main reason to use a text mode editor is to run it inside screen or tmux on a remote machine, but thanks to Tramp, it's usually easier to edit the remote file in your local Emacs. That being said, ...
You can use with-eval-after-load to defer the key binding until after a certain module has been loaded (and thus defined the keymap):
(bind-key "M-Y" #'helm-end-of-buffer helm-map))
Use C-h v helm-map to find which module the keymap is defined in, and thus what to put in the string on the first line.
with-eval-after-load was ...
Not sure exactly what you are asking. But C-h k followed by hitting the key shows you exactly what string you need to pass to kbd. For example, C-h k f6 shows you <f6>.
Here is a command that does what you want, I guess and binds the result to C-c c:
(defun foo (key)
(interactive "kKey: ")
(insert (format "(kbd %S)" (key-description key))))
First, the more general issue: terminal emulators are often limited in the control and escape sequences they can send. So: it may be the case that the terminal swallows your special characters before they reach Emacs. As a general diagnostic, you can hit C-h l (or M-x view-lossage) to see if your key combinations make it into Emacs.
For more discussion of ...
I've also used ido-mode a lot and trained my muscle memory :) I think the ido style is more intuitive than the helm approach. I search for stuff (typing in some characters) and commit to the find (hit RET), just like the search/address bar of my web browser. If the selection is a directory, I enter this directory and start searching again in this directory. ...
A- is the Alt modifier. Which, for clarity, is almost definitely not the key labelled 'Alt' on your keyboard -- that's recognised as the Meta modifier.
Most people simply don't have this modifier key. It's relatively common for people to configure Super and Hyper modifiers on modern keyboards but, probably on account of the potential for confusion, one ...
For closure, here is an answer that expands upon my comment. I define a minor mode with the required keybinding and toggle it in the required buffer using file local variables.
"Minor mode to simulate buffer local keybindings."
(define-key my-org-buffer-local-mode-map (kbd "<f10>...
Emacs "thinks" that C-m is RET because "Control M" is the ASCII control character "carriage return". Even though this reason is "historical" Emacs can run in a terminal and so it needs to support the way terminals still work now.
Try opening a terminal window, typing "ls", and pressing C-m. You will see that it is interpreted as "return", even though you ...
Motion state is an Evil-specific thing, intended for modes where you don't edit text, but still want Vim-style movement available, with all other keys of that mode passing through. Help buffers are an example of such a case, the package.el listing is another one.
Typically you want commands moving point in evil-motion-state-map and everything else in evil-...
As others commented, cua-mode does this, which ships with Emacs. Just M-x cua-mode RET to enable it, or put (cua-mode 1) in your .emacs or .emacs.d/init.el to enable it at startup.
Unless it changed in 24.4, it will also enable using DEL (usually backspace) to delete (without cutting) a selected region, simply starting to type to overwrite (without cutting) ...
Taken from the Emacs Lisp Manual (see Controlling Active Maps):
To quote the manual: "It is very unusual to change the global keymap.". Safety note: Make sure you can save buffers and cleanly exit Emacs afterwards with a different keymap, otherwise you'll have to kill it without saved changes.