On Thu, Jan 19, 2023 at 5:40 PM Christian Brabandt <[email protected]> wrote: > > > 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
Yes, indeed, you can suppress it if you want: everything (or almost) is configurable in Vim (and I just checked: it is the only autocommand in group vimStartup so no side-effects). Or else, you can decide that it is a feature, not a bug, and enjoy having all your editfiles reopened just where you were the last time you used them and not always at the very top. Best regards, Tony. > > > 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) > @Christian: weißt Du wie Jean-Jacques Rousseau dies auf Französisch schreibte? -- -- 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/CAJkCKXvbK0JuCdb9CBiGhPWWjsGW83K3nY8OjuC3t9%2BP8-JJcQ%40mail.gmail.com.
