Friday, June 1, 2018

Re: First line starting with space affects cursor position when switching buffers

On Thu, 31 May 2018, dmccooey@comcast.net wrote:

> Save the file (:w) and switch (:e) to view another file.
> Switch back (:e) to the original file.
> Notice that the cursor is on the first line, not where it was originally.

This is original default behaviour - open file, stand at first char.

But in my .vimrc I have the following snippet
(for so long, that I do not remember where from):
--------------------------------------------------------------------
" Uncomment the following to have Vim jump to the last position when
" reopening a file
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
---------------------------------------------------------------------
With it vim remembers the position-per-filename (in .viminfo)
and jumps to the position re-entering the file.

BUT the ':help viminfo' contains the following 'NOTE':
---------------------------------------------------------------------
The marks are only written when exiting Vim, which is fine because
marks are remembered for all the files you have opened in the
current editing session, unless ":bdel" is used. If you want to
save the marks for a file that you are about to abandon with
":bdel", use ":wv".
---------------------------------------------------------------------

SO, what you (and me too) really need, is some way to make
sure the marks are written, even if we 'abandon the file' !
(Or how to make 'wv' the default instead of typing the v ???)
I assume ':e' does the same as (or imples) ':bdel' with the
current/old file here.

Stucki

--
Christoph von Stuckrad * * | also XMPP = |Mail <stucki@mi.fu-berlin.de> \
Freie Universitaet Berlin |/_*| 'jabber' via|Tel(Mo.,Mi.):+49 30 838-75 459|
IT Mathematik & Informatik|\ *|stucki@jabber| (Di,Do,Fr):+49 30 77 39 6600|
Takustr. 9 / 14195 Berlin * * |.fu-berlin.de|Fax(home): +49 30 77 39 6601/


--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments: