What is the best way to rebind common keys?
Hello, I used evil a while back, but I stopped since the physical key positions were not practical (I was using a dvorak layout then). I would like to give evil a second try, but this time choosing my own keybindings adapted to my current layout (bépo). I thus have two questions. 1. Is there a summary of the default evil bindings, and the functions to which they are bound? 2. What is the recommended way to change bindings? I looked at http://www.emacswiki.org/emacs/Evil and it seems I could simply do a "(define-key evil-normal-state-map … …)". Is there a better way? Thanks, Alan -- OpenPGP Key ID : 040D0A3B4ED2E5C7
If you want to rewrite all the default bindings, I would edit the file evil-maps.el, which contains all the default mappings (it uses define-key). If you wanted to change a few things you could do it in your own init files, but if you want to make extensive changes the easiest way will be to change the original definitions. On 9/23/14, Alan Schmitt <[email protected]> wrote:
Hello,
I used evil a while back, but I stopped since the physical key positions were not practical (I was using a dvorak layout then). I would like to give evil a second try, but this time choosing my own keybindings adapted to my current layout (bépo).
I thus have two questions.
1. Is there a summary of the default evil bindings, and the functions to which they are bound? 2. What is the recommended way to change bindings? I looked at http://www.emacswiki.org/emacs/Evil and it seems I could simply do a "(define-key evil-normal-state-map ... ...)". Is there a better way?
Thanks,
Alan
-- OpenPGP Key ID : 040D0A3B4ED2E5C7
On Tue, Sep 23 2014 (14:11), Gordon Gustafson <[email protected]> wrote:
If you want to rewrite all the default bindings, I would edit the file evil-maps.el, which contains all the default mappings (it uses define-key).
I wouldn't recommend that approach. Either you create a merge nightmare (if you use the repository) or you'll just have to merge manually (also a nightmare, if you use an ELPA) after each update. If you want to extensively change the key maps, just reset the relevant evil key maps, e.g. (setq evil-normal-state-map (make-sparse-keymap) evil-emacs-state-map (make-sparse-keymap) evil-motion-state-map (make-sparse-keymap) evil-visual-state-map (make-sparse-keymap)) If you don't care if the original bindings are still in use just define the new keys. Either way, there's no getting around `define-key'. But evil-maps.el provides the definite listing of key bindings you are looking for. Michael
On 2014-09-23 14:11, Gordon Gustafson <[email protected]> writes:
If you want to rewrite all the default bindings, I would edit the file evil-maps.el, which contains all the default mappings (it uses define-key). If you wanted to change a few things you could do it in your own init files, but if you want to make extensive changes the easiest way will be to change the original definitions.
Looking at evil-maps is a great suggestion, thanks! I'll start with bindings in my own files, and I'll see how it works. Thanks again, Alan -- OpenPGP Key ID : 040D0A3B4ED2E5C7
participants (3)
-
Alan Schmitt -
Gordon Gustafson -
Michael Markert