Friday, January 20, 2023

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

> 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.

--
What a wonderfully exciting cough! Do you mind if I join you?
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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/20230120160124.1A0801C09EE%40moolenaar.net.

No comments: