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)

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/20230119164045.GC1041827%40256bit.org.

Reply via email to