On Sun, Sep 23 2012 (01:47), Patrick Brinich-Langlois <[email protected]> wrote:
Thanks, Michael! That does help. It doesn't affect the bindings in Dired, though. Do I have to define those bindings specifically? For example,
(evil-define-key 'normal dired-mode-map "i" 'evil-forward-char)
Or is there a better way?
Well you can certainly pack it into the function (I made also some other adjustments): (defun set-in-all-evil-states (key def &optional maps additional) (let ((maps (or maps (list evil-normal-state-map evil-visual-state-map evil-insert-state-map evil-emacs-state-map)))) (dolist (map maps) (define-key map key def)) (when additional (dolist (pair additional) (let ((state (first pair)) (map (second pair))) (evil-define-key state map key def)))))) although the interface gets quite messy as you have to encode the states you want to bind: (set-in-all-evil-states "i" 'evil-forward-char nil (list (list 'normal dired-mode-map) (list 'insert dired-mode-map))) You could admit symbols for the maps as well for a more concise one: (set-in-all-evil-states "i" 'evil-forward-char nil '((normal dired-mode-map) (insert dired-mode-map))) (defun set-in-all-evil-states (key def &optional maps additional) (let ((maps (or maps (list evil-normal-state-map evil-visual-state-map evil-insert-state-map evil-emacs-state-map)))) (dolist (map maps) (define-key map key def)) (when additional (dolist (pair additional) (let ((state (first pair)) (map (second pair))) (evil-define-key state (if (symbolp map) (symbol-value map) map) key def)))))) Of course you can tinker any further with it. Have fun, Michael