Is there any in-app linemode equivalent of "vim -r"?

72 views Asked by At

I would like to view the available swap files in the usual directories (home, tmp, etc.) as well as the current working folder.

What can I do? I've seen :h :recover, but that seems to only be suitable for cases when you have a particular swapfile in mind to recover. Is there any that will present me with all the options as vim -r does?

1

There are 1 answers

0
benjifisher On

Try

:echo globpath(&dir, '.*.sw?')

The 'directory' option (short form 'dir') lists the directories where vim tries to create swap files. On some systems, swap files may not start with ., so you would modify the filename pattern accordingly.

If you want to do more than just view the available swap files, you could start with

:let swapfiles = globpath(&dir, '.*.sw?')
:let swapfilelist = split(swapfiles, "\n")

(I think that the "\n" works on all systems.)

:help globpath()
:help swap-file
:help 'directory'
:help expr-option
:help split()