I would like to use evil-complete-previous (or whatever) to complete strings_such_as_this, which is by default not possible. It is possible after (modify-syntax-entry ?_ "w"), but this has the undesired side-effect of rendering it impossible to jump from the beginning of the string to the third s with (evil-forward-word-begin) (w). Can I get the effect without the side-effect?

  • What about M-x dabbrev-expand RET ? – Andreas Röhler Jan 21 at 7:02
  • @AndreasRöhler, it doesn't appear to behave differently. – Toothrot Jan 21 at 12:44

I don't know if this is the best solution, but it works.

(defun evil*-complete-previous () (interactive)
     (let ((old (string (char-syntax ?_))))
       (modify-syntax-entry ?_ "w")
       (modify-syntax-entry ?_ old)))

(define-key evil-insert-state-map (kbd "M-p") 'evil*-complete-previous)
| improve this answer | |

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.