2

I'm trying

(define-key evil-normal-state-map (kbd "o") nil)
(define-key evil-normal-state-map (kbd "o") 'evil-end-of-line)

but the key remains bound to evil-open-below.

FWIW I'm using spacemacs on emacs 24.5.1

  • 1
    Does this happen only for this key? Is it any different when used in an Emacs session (as opposed to in your init file)? – wasamasa Jun 12 '16 at 13:55
  • It happens with other keys as well. It does work when I evaluate it in a session! FWIW all my bindings are done in user-config – El Marcel Jun 13 '16 at 16:28
  • Then you're doing it wrong in your init file :> – wasamasa Jun 13 '16 at 17:54
3

To change definitions inside a keymap, it must be available at the time you access it. In this case it would happen after Evil has been loaded which unless you've explicitly done that before that snippet will not be the case. The cleanest way of deferring it until that point would be using with-eval-after-load:

(with-eval-after-load 'evil-maps
  (define-key evil-normal-state-map (kbd "o") 'evil-end-of-line))
  • Cheers, that did the trick! – El Marcel Jun 14 '16 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.