NEO and Evil

Tempora Tempa tempy_two at web.de
Sat Mar 9 20:18:14 CET 2013


Hi all,

I'm using the NEO keyboard layout, and i want to integrate it somehow with Evil. One case is to change the state bindings of the key 'r', because 'r' is assigned to 'k' on qwert(z|y). Currently i'm doing this by editing the global evil state maps directly:

(define-key evil-normal-state-map "r" nil)
(define-key evil-motion-state-map "r" 'evil-previous-line)

Without setting 'r' to nil in normal state, i would call the evil-replace function every time, when i try to move one line up. I don't know whether this is the clean way of removing key bindings from a map. I've copied this solution from somewhere. Now this approach feels pretty dirty, because i think it's not intended by the developers to change the evil state maps this way. My second idea was to create a NEO minor mode with a sparse keymap and use evil-define-key, as described in the documentation. However, "unsetting" the 'r' keybinding in the normal state didn't work:

(evil-define-key 'normal neo-mode-map "r" nil) ;; or 'undefine instead of nil
(evil-define-key 'motion neo-mode-map "r" 'evil-previous-line)

Pressing 'r' in normal state just doesn't do anything, but doing so in a motion only state buffer (like *Help*) worked. I've tried to understand how the auxiliary keymaps for evil work. It seems the keybinding of 'r' to nil or 'undefine is stored in the auxiliary map and takes precedence over the keybind for the motion state.

Last i found the evil-make-intercept-map and evil-make-overriding-map functions, but i don't think they are solutions to my problem. 

I think the neo-minor-mode solution would be the best way, but i don't know how to completely remove a keybinding from an evil state during such a mode. 

I would be thankful for any advice.

BTW: Please CC me




More information about the implementations-list mailing list