2

I would like to be able to move the cursor around using the visual buffer, but I don't want to add line breaks to the source file. I'm not sure a better way to describe it, so I got some gif examples.

Here is vscode: vscode

Here is emacs: emacs

Both have the same file open and I am moving around the same line of text, vscode treats the wrapped line as multiple while emacs treats it as a single. I would like to make emacs behave like vscode. I have spacemacs installed with the base setup and vim mode.

11
  • 2
    See visual-line-mode in the Emacs manual. Commented Jun 25, 2020 at 4:14
  • @NickD I have that mode enabled already, is there some config that would allow me to use the arrow keys to move around using the visual lines? Commented Jun 25, 2020 at 5:18
  • 3
    Provided you're using Emacs 23+, line-move-visual is what you're looking for, and it's enabled by default. Try with emacs -Q. If it's not working, and you're using Emacs 23 or later, then tell us what commands you're using to move up and down between lines. Commented Jun 25, 2020 at 11:15
  • 1
    Not wanting to be repetitive, but what does C-h v line-move-visual say? Commented Jun 25, 2020 at 14:40
  • 1
    Very good. I think you could go ahead and write your own answer to the question at this point. Commented Jun 25, 2020 at 15:19

1 Answer 1

1

I finally got it working. Emacs has the line-move-visual variable, but spacemacs requires spacemacs/toggle-visual-line-navigation to be run instead. If you want this command to modify the bindings for the arrow keys you'll have to switch spacemacs to the develop branch (as of 2020-06-25). To do this, skip to step 6 below.

If that solves your problem, congratulations! I am still running elementary Hera (based on Ubuntu 18.04) and was having issues with the elpa gpg key being expired. My workaround is to install emacs26, my full process to fix the issues follows.

  1. Remove and purge emacs: sudo apt remove --purge emacs
  2. Remove config: rm ~/.spacemacs && sudo rm -R ~/.emacs.d/
  3. Add emacs stable release PPA: sudo add-apt-repository ppa:kelleyk/emacs
  4. Install emacs: sudo apt install emacs26
  5. Install spacemacs: git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
  6. Change emacs to develop branch: cd ~/.emacs.d/ && git checkout develop
  7. Start emacs: emacs26
  8. Turn on visual line navigation spacemacs/toggle-visual-line-navigation-on

Voilà, visual line navigation with arrow keys on Ubuntu 18.04.

1
  • This has no effect for me using arrow keys or emacs keybindings (C-n/p). Commented Sep 5, 2021 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.