From Newsgroup: comp.editors
Hank Rogers wrote:
:oldfiles
and these are essentially equivalent:
:browse old
:echo v:oldfiles
Which lists the full path to the prior 100 files you have been editing.
I couldn't get it to work on my Mac.
Hi Hank,
This is great information, as I hesitated from adding the Linux/Mac
folks to this PSA even as I was aware they often use gVim also.
Also, on macOS, a lot of people who say 'Vim' are actually running Neovim,
and Neovim does not use viminfo at all, so I just ask you to confirm,
as Neovim uses a different history system called ShaDa but I believe you
as you're technically competent - I just say that for others to benefit.
The rest below assumes you are not using Neovim, but unfortunately,
I don't have a Mac to test. But looking it up, you can use this
command to get the full story in a German-enigma kind of output.
:echo &viminfo
For me, on Windows, from running that command in gVim 8.2, I got:
'100,<50,s10,h,rA:,rB:
Where '100 means remember the last 100 files and
where <50 means store up to 50 lines of registers (like yy buffers) and
where s10 means store up to 10KiB of text from each register and
where h means do not store :history command-line history
(which may explain why my previous q: list was so short)
and where rA: and rB: mean do not store info about files on those drives
(which is apparently a Windows'ism from the floppy-disk era).
If we want more saved history, we can bump the 100 to 500 using
set viminfo='500,<100,s20,h
or even bump it alone
set viminfo='500
For your mac, I'm told (by Google) that Vim on macOS often ships with
viminfo disabled (as google said Apple's built-in /usr/bin/vim is compiled
with a minimal feature set) so Google told me to tell mac users to run
$ vim --version | grep viminfo
If you don't see "viminfo" in the result, you don't have that option.
On my machine, that reported
vim --version | grep viminfo
+cmdline_info +lambda +rightleft +viminfo
Where cmdline_info means my binary supports command-line UI feature
and where lambda means my binary supports lambda expressions
and where we rightleft means it supports right-to-left text editing
but where we really only care about viminfo which enables :oldfiles
If you don't see "viminfo", then you can install MacVim or Homebrew Vim:
$ brew install vim
$ brew install macvim
Also if your .vimrc has the viminfo set to nothing, that would do it too.
set viminfo=
Also, apparently older MacVim builds had a checkbox for viminfo:
MacVim > Preferences > General > Use viminfo
If you're using Neovim, it uses shada, not viminfo.
That ":oldfiles" still works, but only if ShaDa exists.
To test, look for "shada/main.shada" in the output from:
:echo stdpath('state')
If it's missing, this cryptical command forces Neovim to write it:
:qa
A quick diagnostic is tun these isnide of Vim/MacVim:
:echo has('viminfo')
Must be 1
:echo &viminfo
Must not be empty
:echo &viminfofile
Should point to something like ~/.viminfo
Then open and save a few files and run
:oldfiles
What does this report when pasted into your terminal?
$ vim --version | grep viminfo
$ vim --version | head -5
$ ls -l ~/.viminfo ~/.vim/viminfo 2>/dev/null
$ vim -Nu NONE -n --cmd 'echo &viminfo' --cmd 'q'
Disclaimer: I don't have a mac to test this against.
--
On Usenet, experience is meant to be passed along, not hoarded.
--- Synchronet 3.21f-Linux NewsLink 1.2