Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(global-visual-line-mode t) .spacemacs line jumping bug #6177

Closed
GreenHapi opened this issue May 31, 2016 · 16 comments
Closed

(global-visual-line-mode t) .spacemacs line jumping bug #6177

GreenHapi opened this issue May 31, 2016 · 16 comments
Labels
- Bug tracker - Fixed in develop stale marked as a stale issue/pr (usually by a bot)

Comments

@GreenHapi
Copy link
Contributor

GreenHapi commented May 31, 2016

Expected behavior:
By enabling global-visual-line-mode from .spacemacs file I expect to see lines without "long line marks" and to jump lines with j and k as if long lines are real lines. In other words, the same as if I enable global-visual-line-mode or visual-line-mode manually.

Observed behavior:
Lines are shown as real lines without "long line marks" but jumping still works as if it's one long line and visual-line-mode is not enabled. Only after I enable this mode manually again it works as expected.

My OS: Windows 10,
spacemacs dev (All current commits of May 31, 2016 ) and all packages up to date

@izahn
Copy link
Contributor

izahn commented Jun 7, 2016

Perhaps a dumb question, but why don't we just always bind j to evil-next-visual-line and k to evil-previous-visual-line? As far as I can tell these work fine even when visual-line-mode is not on.

@ghost
Copy link

ghost commented Jun 24, 2016

Possibly related to #681.

@kdelwat
Copy link
Contributor

kdelwat commented Oct 23, 2016

@TheGreenHabi Can you confirm that this is still an issue for you? I'm unable to reproduce on the master branch.

System Info 💻

  • OS: gnu/linux
  • Emacs: 25.1.1
  • Spacemacs: 0.200.1
  • Spacemacs branch: master (rev. 3706a42)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
((auto-completion :variables auto-completion-enable-snippets-in-popup t auto-completion-enable-help-tooltip t)
 (clojure :variables clojure-enable-fancify-symbols t cider-font-lock-dynamically
          '(macro core deprecated function)
          cljr-suppress-middleware-warnings t)
 emacs-lisp git html javascript markdown org python
 (shell :variables shell-default-height 30 shell-default-position 'bottom)
 (spell-checking :variables spell-checking-enable-by-default nil)
 syntax-checking themes-megapack
 (version-control :variables version-control-diff-tool 'diff-hl version-control-global-margin t))

@GreenHapi
Copy link
Contributor Author

@kdelwat Unfortunately, the issue is still present. I'm using latest dev as of today and all packages are updated. It's not OS specific, because I observe the same behavior in Ubuntu.

@mentalisttraceur
Copy link

mentalisttraceur commented Nov 24, 2016

I have the same issue, latest master branch with emacs 25.1.1 on Debian Sid.

Fairly new to this community, so I don't exactly know what information you'd all like as far as providing minimal reproduction steps, but I don't mind taking the time to re-run through a from-scratch spacemacs install and see if I can reproduce it with minimal changes. I also tried running (spacemacs/toggle-visual-line-navigation-on) inside my .spacemac's user-config instead of just setting global-visual-line-mode and it didn't work either (running that function interactively once spacemacs has started up works as expected, though).

For those who just want a workaround in the meantime, I've just taken the key-remapping lines from the toggle function and added them to my user-config right after setting global-visual-line-mode and it seems to work.

(global-visual-line-mode t)
(evil-define-minor-mode-key 'motion 'visual-line-mode "j" 'evil-next-visual-line)
(evil-define-minor-mode-key 'motion 'visual-line-mode "k" 'evil-previous-visual-line)

@cjpoor
Copy link

cjpoor commented Mar 20, 2017

Same problem here
spacemacs 0.200.7@24.5.1
emacs Version 24.5 (9.0)
Mac OS X 10.10.5

@TheBaronHimself
Copy link

Same issue here.

Spacemacs 0.200.9
Emacs 25.2.1
macOS 10.12.4

@fredRos
Copy link

fredRos commented May 2, 2017

Perhaps a dumb question, but why don't we just always bind j to evil-next-visual-line and k to evil-previous-visual-line? As far as I can tell these work fine even when visual-line-mode is not on.

This has an impact on other modes, for example magit. With @mentalisttraceur's workaround, moving from hunk to hunk with j,k in the magit status window doesn't work anymore

@mentalisttraceur
Copy link

@fredRos Thanks for noting that publicly. Since posting the workaround I've not had time to come back around to this, but I've seen a couple of corner cases where things aren't ideal with my workaround, and that's definitely one of them.

@NightMachinery
Copy link

I also have this issue on emacs Mac port.

@ctholho
Copy link

ctholho commented Jun 4, 2018

I also still have this issue.
to brutally help myself without regards to common emacs sense, I put this into my .spacemacs

(define-key evil-normal-state-map (kbd "j") 'evil-next-visual-line)
(define-key evil-normal-state-map (kbd "k") 'evil-previous-visual-line)

Still works with magit.

@duianto
Copy link
Contributor

duianto commented Oct 29, 2019

The following PRs (possibly modified) changes are now on the develop branch:
Add toggle visual-line-navigation-globally #11417

Visual line navigation globally can be toggled with the key binding SPC t C-S-l.
And/or on startup by adding:

(spacemacs/toggle-visual-line-navigation-globally-on)

to the dotspacemacs/user-config section of your .spacemacs.

@mikemc
Copy link

mikemc commented Jan 8, 2020

I am running on the current develop branch and have these lines in my dotspacemacs/user-config section,

  (set-fill-column 79)
  (global-visual-line-mode)
  (global-visual-fill-column-mode)
  (spacemacs/toggle-visual-line-navigation-globally-on)

However, visual line navigation doesn't work until I run SPC t C-S-l twice after startup. The first time, I get the message that "visual-line-navigation-globally" is disabled, and visual-line-mode seems to get turned off. After doing the toggle the second time it says its enabled; and then things finally work. So it seems like spacemacs is starting with the toggle state set to enabled, but not giving the correct behavior until it is toggled off and on again.

Edit: Ok, I noticed that if I comment out the line with (global-visual-line-mode) then visual line mode and visual line navigation work, but visual-fill-column doesn't. So I'm likely misunderstanding something basic about how spacemacs/emacs configuration is working here.

@github-actions
Copy link

github-actions bot commented Jan 7, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Jan 7, 2021
@mentalisttraceur
Copy link

So is the "official" Spacemacs-y solution to this issue just "use (spacemacs/toggle-visual-line-navigation-globally-on) instead of (global-visual-line-mode) in your config"?

If so, then I think

  1. this should be closed with that as the official solution,

  2. if this is not documented anywhere, then there should probably be a new issue opened along the lines of "document Spacemacs-y alternatives to standard visual line mode functions/configuration", and

  3. if there are deficits in the Spacemacs-y alternatives, like the above comment that it interferes with visual fill column mode somehow, then separate issues should be opened for those.

@duianto
Copy link
Contributor

duianto commented Apr 17, 2021

Edit: Ok, I noticed that if I comment out the line with (global-visual-line-mode) then visual line mode and visual line navigation work, but visual-fill-column doesn't. So I'm likely misunderstanding something basic about how spacemacs/emacs configuration is working here.

It doesn't seem to work to set the fill column in the user config with:

(set-fill-column 79)

Probably because the default value is set to 80 here:

(setq-default fill-column 80)

But it works to change it with:

  (setq-default fill-column 79)

mentalisttraceur, thanks for suggesting next actions for this thread.
This got lost in the saved notifications,
but I stumbled over this now and had time to test it.

If so, then I think
this should be closed with that as the official solution,

The bot beat us to it.

So is the "official" Spacemacs-y solution to this issue just "use (spacemacs/toggle-visual-line-navigation-globally-on) instead of (global-visual-line-mode) in your config"?

and:

if this is not documented anywhere, then there should probably be a new issue opened along the lines of "document Spacemacs-y alternatives to standard visual line mode functions/configuration", and

There is an entry in the FAQ:
https://github.com/syl20bnr/spacemacs/blob/develop/doc/FAQ.org#enable-navigation-by-visual-lines

Enable navigation by visual lines?

It mentions adding:

(spacemacs/toggle-visual-line-navigation-globally-on)

to the user-config.

if there are deficits in the Spacemacs-y alternatives, like the above comment that it interferes with visual fill column mode somehow, then separate issues should be opened for those.

The suggestion above of using setq-default to set the fill-column seems to be the solution to mikemc's issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Bug tracker - Fixed in develop stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests