Search code examples
vimsyntastictext-cursor

Cursor jump in Vim after save


I started to experience a strange behavior in Vim - when saving a file (:w) the cursor jumps to a specific location in a file. The location is constant and is different for different files, that is, it can be a beginning of a function etc, but if I move the line up or down, the location after save remains.

My .vimrc is quite long, and for now I tried only :noautocmd command.

How can I fix or debug this?


Solution

  • From the syntastic's docs:

    When set to 0 the cursor won't jump automatically. (let g:syntastic_auto_jump = 0)

    When set to 1 the cursor will always jump to the first issue detected, regardless of type. (let g:syntastic_auto_jump = 1)

    When set to 2 the cursor will jump to the first issue detected, but only if this issue is an error. (let g:syntastic_auto_jump = 2)

    When set to 3 the cursor will jump to the first error detected, if any. If all issues detected are warnings, the cursor won't jump. (let g:syntastic_auto_jump = 3)

    So adding

    let g:syntastic_auto_jump = 0
    

    has solved the problem. Not clear why the problem suddenly appeared, but here's the fix for whoever needs it.