Saturday, January 21, 2023

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

* Bram Moolenaar <Bram@moolenaar.net> [230120 11:01]:
>
> > 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?
>
> How about:
> - When writing the buffer set some flag, e.g. b:did_write_this_buf
> - When exiting, go through all buffers and those that don't have the
> b:did_write_this_buf flag move the cursor to the " mark.
>
> Something like that.

I don't think we need another flag; just use the 'modified' option. I
think this is what the OP wants, and is simpler.

I also think Salman Halim's suggestion of using the . mark instead of the
" mark is more useful.

...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/Y8wKilsT9IqIj56h%40basil.wdw.

No comments: