diff runtime/doc/builtin.txt @ 31347:56a2af8c0980 v9.0.1007

patch 9.0.1007: there is no way to get a list of swap file names Commit: https://github.com/vim/vim/commit/c216a7a21a25a701b84b79abc1ba6ab0baa3a311 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 5 13:50:55 2022 +0000 patch 9.0.1007: there is no way to get a list of swap file names Problem: There is no way to get a list of swap file names. Solution: Add the swapfilelist() function. Use it in the test script to clean up. Remove deleting individual swap files.
author Bram Moolenaar <Bram@vim.org>
date Mon, 05 Dec 2022 15:00:11 +0100
parents a7801222c9c5
children 15c80d8bc515
line wrap: on
line diff
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -608,6 +608,7 @@ submatch({nr} [, {list}])	String or List
 					specific match in ":s" or substitute()
 substitute({expr}, {pat}, {sub}, {flags})
 				String	all {pat} in {expr} replaced with {sub}
+swapfilelist()			List	swap files found in 'directory'
 swapinfo({fname})		Dict	information about swap file {fname}
 swapname({buf})			String	swap file of buffer {buf}
 synID({lnum}, {col}, {trans})	Number	syntax ID at {lnum} and {col}
@@ -9314,6 +9315,17 @@ substitute({string}, {pat}, {sub}, {flag
 		Can also be used as a |method|: >
 			GetString()->substitute(pat, sub, flags)
 
+swapfilelist()						*swapfilelist()*
+		Returns a list of swap file names, like what "vim -r" shows.
+		See the |-r| command argument.  The 'directory' option is used
+		for the directories to inspect.  If you only want to get a
+		list of swap files in the current directory then temporarily
+		set 'directory' to a dot: >
+			let save_dir = &directory
+			let &directory = '.'
+			let swapfiles = swapfilelist()
+			let &directory = save_dir
+
 swapinfo({fname})					*swapinfo()*
 		The result is a dictionary, which holds information about the
 		swapfile {fname}. The available fields are: