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?

  • Does customizing evil-cross-lines help? – wasamasa Aug 9 '15 at 16:16
  • No, it doesn't change anything after toggling it. – El Diego Efe Aug 11 '15 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 '15 at 16:51
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, privacy policy and cookie policy

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