I'm using SpaceVim with Neovim, and often times I'd experience this cursor jumping issue (as if ^ has been pressed in normal mode) while using it. I doubt the bug is on the Neovim end, otherwise a lot more people definitely would've raised it by now.

An issue has already been opened in SpaceVim about it: https://github.com/SpaceVim/SpaceVim/issues/3159

However we don't know how to reproduce it.

I've personally notice it occurring most often while:

  • navigating a line with w or e; and when that becomes the case, doing something like cw becomes extremely annoying as it ends up jumping the cursor to the first non-blank character of the line and changing that instead of the actual word I wanted

  • while saving the file with either the normal Vim command of :w or the SpaceVim keybinding of Space f s; thereby it doesn't appear those specific keybindings are the problem. And when this misbehavior is activated, this jumping to the line start reliably occurs on every subsequent saves

It also appears to happen regardless of the filetypes (for myself those are most often: .md, .vim, .lua, .py)

The only "workaround" I found is to activate another buffer by switching to it, either by just opening it if it's hidden, or switching to buffers in other tabs, or even opening a split (a help split works) in the same tab. This will suppress the problem for some time, could be for a long while, but also could happen again soon after a few more line navigations.

At this point I'm not even quite sure how to go about to diagnose this bug. The submitter already went and disabled many of the layers (and thereby most of the plugins), and he claims it still occurs. Is it caused by some autocmds perhaps? But that also seems dubious since it occurs very unpredictably while just navigating. Also the fact that switching to another buffer then switching back temporarily suppresses the problem leads me to think that maybe there's some buffer state variable/property that gets reset every time you exit and enter it?

Any ideas on how to proceed on fixing this is appreciated.

  • 2
    The only way for an answerer to reproduce this would be to go through the work of setting up SpaceVim and working on it. Due to the complexity of SpaceVim, I very much doubt anyone will do that—it's simply too complex a beast to track stuff like this down in easily. It's why I don't recommend it, never ever. Because I prefer to understand the tool I'm using. But FWIW, I've never seen anything like this. Some things you can try: :debug, -V (verbose logging—level 9 or higher could be useful), -D debugging, or our how to debug my vimrc post
    – D. Ben Knoble
    Nov 24, 2019 at 20:49
  • 2
    One way I have successfully helped someone debug a similar issue is to use vim -w scriptout to record your keystrokes to a file. If you manage to reproduce the issue, you can then stop recording and see if you can reproduce it again using vim -s scriptout (you can edit the scriptout file to remove extraneous parts.) If you manage to reproduce it consistently with that script, you can then use that as a basis to debug your vimrc and plugins. You can also check if someone with the same setup can also reproduce the issue. Good luck!
    – filbranden
    Nov 24, 2019 at 21:09