Friday, January 20, 2023

Re: Why does (my) Vim leave the cursor to the last mark even if I don't save the file?

* Christian Brabandt <cblists@256bit.org> [230120 05:39]:
>
> On Fr, 20 Jan 2023, 'Ottavio Caruso' via vim_use wrote:
>
> > Am 19/01/2023 um 16:40 schrieb Christian Brabandt:
> > > On Do, 19 Jan 2023, 'Ottavio Caruso' via vim_use wrote:
> > > > $ 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
> >
> > Thanks, but if do that, I'd then remove this feature from all files, whether
> > edited or not, wouldn't I?. Is it possible to have this implemented only on
> > files that are saved?
>
> I would find it inconsistent for somtimes jumping to a different spot in
> a file and sometimes not. I might not even remember if I last time saved
> that particular file or not (e.g. I just need to check something but did
> not save the file). That might be confusing.
>
> It might be possible to change that behaviour using a custom function
> (e.g. set a flag on BufWritePost, check that flag on a BufLeave
> autocomamnd and set the '" mark accordingly). Not sure if this will work
> or not.
>
> Mit freundlichen Grüßen
> Christian

I think what he is asking is for the " mark to only be written to the
viminfo file for buffers that have been modified. I'm not sure how to
do this or if it is even possible, but it seems like a perfectly
reasonable behavior to want.

Perhaps a VimLeavePre autocommand that wipes unmodified buffers? What
other settings for those buffers would not be saved to .viminfo?

...Marvin

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/Y8qX%2B2Ilouc3PmUq%40basil.wdw.

No comments: