Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

conflicts with `evil-respect-visual-line-mode' #70

Closed
ghost opened this issue Aug 27, 2019 · 4 comments
Closed

conflicts with `evil-respect-visual-line-mode' #70

ghost opened this issue Aug 27, 2019 · 4 comments

Comments

@ghost
Copy link

ghost commented Aug 27, 2019

By default, evil-magit uses evil-next-visual-line and evil-previous-visual-line for movement, which is what I want, but for some reason this seems to conflict with enabling evil-respect-visual-line-mode. In my init.el, I have the following use-package declaration for evil:

(use-package evil
  :straight t
  :demand t
  :init
  ;; set before evil is loaded, as per evil docs
  (setq evil-respect-visual-line-mode t))

Normally, this configuration works, e.g. in a markdown buffer with visual-line-mode enabled. However, line-wise movement in magit-mode (e.g. an expanded diff) with visual-line-mode jumps between hard line breaks, as if evil-respect-visual-line-mode was never enabled. If I invoke M-x evil-next-visual-line it works fine, and tells me (incorrectly) that I can run it with 'j'. If I ask for what 'j' does run with M-x describe-key it says evil-next-line.
If I don't enable evil-respect-visual-line-mode then everything works as I would like, and line-wise movement properly accounts for visual-line-mode. Unfortunately, since evil-respect-visual-line-mode has to be set before evil is loaded, I can't disable it for magit-mode only. It's either globally enabled or disabled.

@justbur
Copy link
Member

justbur commented Aug 28, 2019

I have an idea about what might be happening. evil-magit uses visual lines by default and evil-repsect-visual-line-mode is probably remapping that unintentionally to the command for regular lines. I recently put in a PR to evil to fix and improve evil-repsect-visual-line-mode and that should fix this issue.

magit itself is based on real lines, so it's not ideal to use visual-line-mode in magit anyway, but I'll assume you have a reason to do that.

@ghost
Copy link
Author

ghost commented Aug 29, 2019

That's what I assumed was happening, too. Would it make sense to just use normal line-wise movement (e.g. evil-next-line) and leave it up the user to enable evil-respect-visual-line-mode if they need it? I use it when viewing diffs of prose which have paragraphs as single soft-wrapped lines, with magit-diff-refine-hunk enabled to see word diffs. Maybe this isn't the best strategy, though.

@justbur justbur closed this as completed in 4b66a1d Sep 4, 2019
@justbur
Copy link
Member

justbur commented Sep 4, 2019

Yes, I think that makes sense. In retrospect, I don't know why I chose to use those commands in the first place. I changed it in 4b66a1d

@ghost
Copy link
Author

ghost commented Sep 4, 2019

Works perfectly now, as far as I can tell. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant