简体   繁体   中英

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

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?

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM