evil icon indicating copy to clipboard operation
evil copied to clipboard

visual-line-mode doesn´t work as expected with evil enabled

Open omidmash opened this issue 10 months ago • 6 comments

Doom Emacs:

C h v visual-line-mode is t. The lines in my .org text (the buffer where it's enabled) do get wrapped, however, pressing j k only moves up and down in a logical manner, and not in a visual manner. When evil mode is disabled, this doesn´t happen. I tried doom upgrade. The issue persists.

omidmash avatar Feb 11 '25 13:02 omidmash

What value do you have for evil-respect-visual-line-mode?

tomdl89 avatar Feb 11 '25 15:02 tomdl89

nil. I changed it manually with (setq evil-respect-visual-line-mode t) to t, the behavior doesn´t change.

omidmash avatar Feb 11 '25 15:02 omidmash

Ah, this is a bit of a gotcha in evil. The code that swaps the keybindings in evil is only called once, when evil is loaded: https://github.com/emacs-evil/evil/blob/master/evil-integration.el#L434-L445 so it looks like you'll need to set this before loading evil in your init.el (or using the :init keyword in use-package).

tomdl89 avatar Feb 11 '25 15:02 tomdl89

Neither

(use-package-hook! evil
  :pre-init
  (setq evil-respect-visual-line-mode t)
  t)

nor

(use-package-hook! evil
  :pre-init
  (setq evil-respect-visual-line-mode t))

or

(use-package-hook! evil
  :pre-config
  (setq evil-respect-visual-line-mode t))

works unfortunately. Now this is a dooms package manager issue I believe, because C h v evil-respect-visual-line-mode still shows nill.

omidmash avatar Feb 11 '25 16:02 omidmash

Yeah, I'm not a Doom user, so can't help you there. But this issue does make me think we should make this easier in evil anyway. We could make it so setting at any time could enable this functionality. Worth a look. Not sure when I'll get to it, but hopefully soon.

tomdl89 avatar Feb 11 '25 16:02 tomdl89

Cheers!

omidmash avatar Feb 11 '25 16:02 omidmash