You are not logged in.

#1 2014-07-30 22:24:49

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

vim saves the postion of the cursor only for the last file.

If I edit a couple files in tabs (as opposed to e.g. ':split' or ':e' buffers, only the last file that was saved has the cursor in the right place, the other files have the edited content, but the cursor is in the wrong place, not where I left it the last time.

I'm using

if has("autocmd")
      autocmd BufReadPost *
      \ if line("'\"") > 0 && line("'\"") <= line("$") |
      \ exe "normal g`\"" |
      \ endif
endif

in my ~/.vimrc to make vim remember where I left off. I noticed it stopped working some time ago, but was too busy to investigate. Seems 7.4.335-4 is the version that broke it, 7.4.307-4 works. You can use 'downgrade' form the AUR to get the old version.

'vim -p 0 1' open 2 files in tabs, I save each of them in turn and exit. Only the file that has been saved last has the cursor in the right position.
Can somebody please check if I'm just seeing things or is it a bug / configuration change?

I didn't find anything about it in https://code.google.com/p/vim/issues/li … &start=200 but http://stackoverflow.com/questions/2473 … gh-enabled may be suffering from the issue I'm describing.

Offline

#2 2014-07-30 23:18:24

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: vim saves the postion of the cursor only for the last file.

Confirmed. I'm using the same function that you are. I hadn't really looked at it though, so I have no solution.

Offline

#3 2014-07-31 01:04:01

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 714

Re: vim saves the postion of the cursor only for the last file.

I'm using the same autocmd (from $VIMRUNTIME/vimrc_example which is sourced into my ~/.vimrc) and it still works fine for me on my up to date Arch X64 system.

Offline

#4 2014-07-31 01:11:23

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: vim saves the postion of the cursor only for the last file.

Works fine here (383: vim only, no gvim installed), but I also use view.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2014-07-31 01:33:07

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 714

Re: vim saves the postion of the cursor only for the last file.

Note that any time I have found that vim's last position in file function has stopped working properly it has been because root has taken ownership of my ~/.viminfo file.

Offline

#6 2014-07-31 09:50:50

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: vim saves the postion of the cursor only for the last file.

bulletmark wrote:

Note that any time I have found that vim's last position in file function has stopped working properly it has been because root has taken ownership of my ~/.viminfo file.

That's what I thought too, but the permissions were OK and the position was saved properly once in a while. It took me some time to figure it out, especially since I recently moved from urxvtd to st+tmux and had to be sure tmux wasn't fscking with me.

Offline

Board footer

Powered by FluxBB