On Do, 19 Jan 2023, 'Ottavio Caruso' via vim_use wrote:
> Ok, the title is probably not accurate, so I'll try to explain.
>
>
> Let's say I have a file with 5 lines
>
> --------------------------
>
> This is line 1
> Another line
> More lines
> Even more lines
> This is the last line
>
> -------------------------
>
> I save the file (Esc w q). When I reopen it, the cursor is at the end of
> line 5.
>
> Then I move the cursor up two lines. I quit without saving (Esc q!).
>
> When I reopen the file, the cursor is now at the 3rd line.
>
> Is this intended behaviour? If so, how can I tell Vim to ignore movements
> but just this time?
>
The behaviour you are seeing, comes from a BufReadPost autocommand, that
restores the last cursor position. It's defined in the help below
:h last-position-jump
> $ cat .vim/vimrc
> source $VIMRUNTIME/defaults.vim
This is where the auto command is defined. If you do not want it, you
can delete this after sourcing the defauls.vim file:
:augroup vimStartup | au! | augroup END
Best
Christian
--
Es mag zu meinem Vorteil oder Nachteil ausfallen, ich fürchte nicht,
so gesehen zu werden, wie ich bin.
-- Jean Jacques Rousseau (an Malesherbes, 1762)