summaryrefslogtreecommitdiffstats
path: root/runtime/doc
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-12-05 13:50:55 +0000
committerBram Moolenaar <Bram@vim.org>2022-12-05 13:50:55 +0000
commitc216a7a21a25a701b84b79abc1ba6ab0baa3a311 (patch)
treee8bda92c7339e1960d00dc035f0de82f3c2b975a /runtime/doc
parent65214053f6a4bdb1099404a4b5dccb85ca3e5c7c (diff)
patch 9.0.1007: there is no way to get a list of swap file namesv9.0.1007
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.
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/builtin.txt12
-rw-r--r--runtime/doc/usr_41.txt1
2 files changed, 13 insertions, 0 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 1d701379ca..7ae3082205 100644
--- 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}, {flags}) *substitute()*
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:
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 43a13d9861..850a4c5934 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -1031,6 +1031,7 @@ Buffers, windows and the argument list:
getwininfo() get a list with window information
getchangelist() get a list of change list entries
getjumplist() get a list of jump list entries
+ swapfilelist() list of existing swap files in 'directory'
swapinfo() information about a swap file
swapname() get the swap file path of a buffer