• PSA: How to list the last 100 files you've edited in the Windows gVim editor

    From Maria Sophia@mariasophia@comprehension.com to alt.comp.os.windows-10,comp.editors on Fri Apr 3 17:30:18 2026
    From Newsgroup: comp.editors

    PSA:
    How to list the last 100 files you've edited in the Windows gVim editor

    Doing research all night, as I am wont to do, I was editing what started
    out as a batch file but which turned into a long researched listing, and
    then in the morning when the sun came up, I shut down the PC and when I
    awoke I had forgotten where I had placed the long-edited text file.

    I had completely forgotten, in the fog of late-night frenzy sans sleep,
    that it was originally a batch file but turned into a simple text file.

    I typed "q:" in an empty gvim session to get a list of prior commands,
    where I could see some of my search-n-replace actions, but not file names.

    I tried the Windows runbox pinned to my taskbar to enter "shell:recent"
    but that C:\Users\.\AppData\Roaming\Microsoft\Windows\Recent folder
    was completely empty (possibly due to Windows privacy settings).
    Settings > Personalization > Start > Show recently opened items...
    But more likely due to the fact that gVim is a win32 application overall.

    There's the tedious way which I wouldn't use unless God ordered me to:
    C:\> findstr /s /i /m "Some Word" C:\*.txt
    (But it turns out that wouldn't have worked as it was in "x.bat".)

    Of course I could ls -l the usual dirs but I knew what editor I was using
    & I found that gvim 8.2 doesn't have a "recent files" GUI, but it has
    :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 didn't know about ":oldfiles" (which is a privacy issue also), so I
    figured I'd let you guys who use the gVim editor know about this trick.
    --
    On Usenet, we're all old friends on the same kind & helpful team.
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Hank Rogers@Hank@nospam.invalid to alt.comp.os.windows-10,comp.editors on Fri Apr 3 16:40:52 2026
    From Newsgroup: comp.editors

    Maria Sophia wrote on 4/3/2026 4:30 PM:
    PSA:
    How to list the last 100 files you've edited in the Windows gVim editor

    Doing research all night, as I am wont to do, I was editing what started
    out as a batch file but which turned into a long researched listing, and
    then in the morning when the sun came up, I shut down the PC and when I
    awoke I had forgotten where I had placed the long-edited text file.

    I had completely forgotten, in the fog of late-night frenzy sans sleep,
    that it was originally a batch file but turned into a simple text file.

    I typed "q:" in an empty gvim session to get a list of prior commands,
    where I could see some of my search-n-replace actions, but not file names.

    I tried the Windows runbox pinned to my taskbar to enter "shell:recent"
    but that C:\Users\.\AppData\Roaming\Microsoft\Windows\Recent folder
    was completely empty (possibly due to Windows privacy settings).
    Settings > Personalization > Start > Show recently opened items...
    But more likely due to the fact that gVim is a win32 application overall.

    There's the tedious way which I wouldn't use unless God ordered me to:
    C:\> findstr /s /i /m "Some Word" C:\*.txt
    (But it turns out that wouldn't have worked as it was in "x.bat".)

    Of course I could ls -l the usual dirs but I knew what editor I was using
    & I found that gvim 8.2 doesn't have a "recent files" GUI, but it has
    :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 didn't know about ":oldfiles" (which is a privacy issue also), so I
    figured I'd let you guys who use the gVim editor know about this trick.


    I couldn't get it to work on my Mac.


    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Maria Sophia@mariasophia@comprehension.com to alt.comp.os.windows-10,comp.editors on Fri Apr 3 19:04:20 2026
    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