0

The following keybindings work when simply moving. However, when pressing d and then one of these keys, the behavior is not as expected.

When pressing dL it will delete until the end of the page. When pressing dH it will delete until the top of the page.

I suspect that there are some default bindings for these keys that are not overwritten. Is there a delete state map that I need to define this for as well or something I need to specify to overwrite the keys?

(define-key evil-normal-state-map (kbd "H") (kbd "^")) ; H goes to beginning of the line
(define-key evil-normal-state-map (kbd "L") (kbd "$")) ; L goes to end of the line
3
  • "the behavior is not as expected" means what? You don't say what you expect. Please be specific about what you expect vs what you see instead.
    – Drew
    Commented Feb 10, 2023 at 21:29
  • I agree. It is fixed now
    – Veggeata
    Commented Feb 11, 2023 at 3:51
  • Thanks ---------------
    – Drew
    Commented Feb 11, 2023 at 17:31

1 Answer 1

0

The ^ and $ is bind to evil-motion-state-map through evil-define-motion, so you need:

(define-key evil-motion-state-map (kbd "H") 'evil-first-non-blank)
(define-key evil-motion-state-map (kbd "L") 'evil-end-of-line)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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