Describe the feature
A shared/standardized set of key binding for common commands/operation of different language major mode (e.g. jump-to-definition, jump-back, compile, run, evaluate)
Status Quo
Currently, each language has its own key binding, e.g:
C-c C-t is bound to tide-jump-to-definition ; C-t is bound to jump-back to previously marked bufferC-c C-j is bind to godef-jump; C-o is bound to jump-back to previously marked bufferracer-find-definitionWish list
Ideally, developers should not have to remember different sets of hot keys for different languages, and it would be nice to
caveats
As for downside of this is that this standardization layer might cause conflicts in hot keys with the native language.el, so would be nice to have a pop-up buffer for resolving conflict if accidentally customize the bindings into one.
A standard already exists for many of these commands, defined in the :config (default +bindings) module. Most of them are available under the leader prefix (which is SPC for evil users and C-c for non-evil users). Here are a few of them:
gd (or SPC c d) -- this will invoke racer-find-definition in rust, godef-jump in go, tide-jump-to-definition in typescript, and so on. They will also fall back to more naive backends, if those fail.gD (or SPC c D)K (or SPC c k)C-i / C-o (ala the vim jumplist)gr (operator), gR (from normal mode, this evaluates the buffer. From visual mode, it replaces the selection with its return value)SPC c c for compile and SPC p c for projectile-compile. The former runs the compile command in the current directory, and the latter runs it in the project's root.C-c g d -- this will invoke racer-find-definition in rust, godef-jump in go, tide-jump-to-definition in typescript, and so on. They will also fall back to more naive backends, if those fail.C-c g DC-c g kM-, (this is an Emacs default, as far as I know, there is no jump forward, however. I'm open to suggestions for places to bind better-jump-forward -- we use the better-jump package to provide a universal jumplist)C-c e (evaluates line or region)C-c p c = projectile-compile (C-c p is the prefix for project commands)I apologize there isn't much documentation on the matter (I'm working on it), but there are many more; more than I can list here.
Ah, I forgot to talk about customizing your own keybinds. Emacs provides a library for doing so that you can use from ~/.doom.d/config.el, such as define-key KEYMAP KEY DEFINITION, e.g.
(after! elisp-mode ; run this code after the elisp-mode package is loaded
(define-key emacs-lisp-mode-map "x" #'dosomething))
Doom also provides the map! macro to make things a little easier, particularly for evil users.
(map! :after python ; binds these after the python package has loaded
:map python-mode-map
"x" #'dosomething
"y" #'dosomethingelse
"z" #'anotherthing)
You can find documentation on these with SPC h f <functionname> (or C-h f <functionname> for non-evil users). The documentation buffer will include examples on how to use them and links to their definition.
You can also find out what's bound to a key sequence with SPC h k <keysequence> or C-h k <keysequence>.
Hope that helps!
Most helpful comment
A standard already exists for many of these commands, defined in the
:config (default +bindings)module. Most of them are available under the leader prefix (which isSPCfor evil users andC-cfor non-evil users). Here are a few of them:For evil users (scheme inspired by vim conventions)
gd(orSPC c d) -- this will invoke racer-find-definition in rust, godef-jump in go, tide-jump-to-definition in typescript, and so on. They will also fall back to more naive backends, if those fail.gD(orSPC c D)K(orSPC c k)C-i/C-o(ala the vim jumplist)gr(operator),gR(from normal mode, this evaluates the buffer. From visual mode, it replaces the selection with its return value)SPC c cforcompileandSPC p cforprojectile-compile. The former runs the compile command in the current directory, and the latter runs it in the project's root.Source
For non-evil users:
C-c g d-- this will invoke racer-find-definition in rust, godef-jump in go, tide-jump-to-definition in typescript, and so on. They will also fall back to more naive backends, if those fail.C-c g DC-c g kM-,(this is an Emacs default, as far as I know, there is no jump forward, however. I'm open to suggestions for places to bindbetter-jump-forward-- we use thebetter-jumppackage to provide a universal jumplist)C-c e(evaluates line or region)C-c p c=projectile-compile(C-c pis the prefix for project commands)Source
I apologize there isn't much documentation on the matter (I'm working on it), but there are many more; more than I can list here.