2

Running spacemacs 0.200.13 on emacs 25.2.2 on Kubuntu 18.04.

In ~/.spacemacs, there is:

(global-visual-line-mode t)
(add-hook 'text-mode-hook #'visual-line-mode)

So, when I open a text file, I see long lines as multiple screen lines.

But when I press j or k, it moves according to actual line, not screen line. That is, j or k moves multiple screen lines.

SPC h d k j shows j bound to evil-next-line

What is happening here? How do I get j and k to move as per screen line even in normal mode?

deshmukh
  • 1,852
  • 13
  • 29
  • This seems like expected behaviour... Movement does indeed occur according to actual lines, not screen lines, when in the `normal state`. When entering `insert state` and using the arrow keys up and down, you should move according to the screen line. – EFLS Jun 04 '18 at 09:43
  • @EFLS Yes. I agree. Any idea how can one get the screen-line wise movement even in normal mode? – deshmukh Jun 05 '18 at 16:01
  • I think this is part of the `vim` emulation of `evil`. Since `vim` works with movements (characters, words, sentences, lines, etc.) rather than visual lines, I'd guess it is an indispensable part of the `vim` experience. I have to admit it was difficult to adopt this mindset at first, but once you get used to it, it becomes second nature. Make sure to learn the `vim` keys to move between sentences (`(` `)`), paragraphs (`[` `]`), words, etc. And also learn to use `avy` for easier movement. – EFLS Jun 07 '18 at 15:24

1 Answers1

2

You want spacemacs/toggle-visual-line-navigation. In addition to turning on visual-line-mode, it rebinds j/k to evil-next/previous-visual-line.

Matt Kramer
  • 251
  • 2
  • 6
  • Yes. That is what I do. But I thought, once done, it applies to all subsequent buffers/ sessions. – deshmukh Oct 09 '18 at 05:22
  • I've submitted a [PR](https://github.com/syl20bnr/spacemacs/pull/11417) to add a global toggle. Assuming it makes it into the 0.300 release, you'll be able to do `spacemacs/toggle-visual-line-navigation-globally`. Until then, you should be able to survive by adding `spacemacs/toggle-visual-line-navigation` to your `find-file-hook`. – Matt Kramer Oct 11 '18 at 00:04