1

I use evil-mode (from spacemacs) and I get a strange behaviour which I'm not sure if it is right or a bug. If I delete words (with dw, i think it calls evil-delete), it works until I arrive at the last word in the line, after that it starts to delete the last remaining character in the same line (backwards delete one char). Maybe the problem is the way auto-fill-mode is splitting the lines in a paragraph.

How to make dw delete words in the following line once it reached the last word in a line?

3
  • Does customizing evil-cross-lines help?
    – wasamasa
    Aug 9, 2015 at 16:16
  • No, it doesn't change anything after toggling it. Aug 11, 2015 at 16:38
  • Could you add an example to the question to make clearer what the expected and the actual behaviour would be?
    – wasamasa
    Aug 11, 2015 at 16:51

1 Answer 1

4

This is expected Vim behavior.

One way to fix this is to just switch to d e instead of d w when you get to the EOL (which I recommend), or you can make that switch automatic:

(defun nadvice/evil-forward-word-begin (old-fun &rest args)
  (if (looking-at "[[:space:]]*$")
    (progn
      (apply #'evil-forward-word-end args)
      ;; fix off-by-one
      (evil-forward-char))
    (apply old-fun args)))

(advice-add #'evil-forward-word-begin :around #'nadvice/evil-forward-word-begin)

Your Answer

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

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