3

I use vim in the following way:

I open vim.

  1. Then I press i to start writing.

  2. Then I save the buffer and give the file a name by issuing the command :w some-file-name.txt

  3. Then I quit vim by :x

Then I would expect some-file-name.txt to be in the oldfiles list next time I open vim, but when I use :oldfiles it is not there.

If I, on the other hand, start my process by using :e some-file-name.txt and thereby giving the file a name before I write the content, then the file is actually showing up in the oldfiles list next time I start vim.

But I prefer writing content first and then giving the filename later.

Does anyone know why my preferred workflow does not put my last edited file in oldfiles?

  • Btw, I just installed nvim. And in nvim oldfiles does indeed list a file created with my workflow as described in the question. – L Kiil Nov 20 at 11:18
  • the files created in the above mentioned ways do show up in :marks in vim - but not in :oldfiles it seems – L Kiil Nov 20 at 11:55
  • 2
    @ChristianBrabandt I see same problem persists in a quite modern build (8.2.1941). v:oldfiles do not get updated, unless the buffer was read from disk at least once (doing extra :e between steps (2) and (3) helps). – Matt Nov 21 at 7:45
  • 1
    Thanks, I have done so here: github.com/vim/vim/issues/7348 – L Kiil Nov 23 at 9:08
  • 1
    I created github.com/vim/vim/pull/7350 to fix this – Christian Brabandt Nov 23 at 10:33
2

Looks like a vim bug: https://github.com/vim/vim/issues/7348

Which Christian Brabandt has opened a PR to fix: https://github.com/vim/vim/pull/7350

It was merged and released in Vim version 8.2.2039.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.