diff src/evalfunc.c @ 14599:72d6f6f7ead7 v8.1.0313

patch 8.1.0313: information about a swap file is unavailable commit https://github.com/vim/vim/commit/00f123a56585363cd13f062fd3bb123efcfaa664 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 21 20:28:54 2018 +0200 patch 8.1.0313: information about a swap file is unavailable Problem: Information about a swap file is unavailable. Solution: Add swapinfo(). (Enzo Ferber)
author Christian Brabandt <cb@256bit.org>
date Tue, 21 Aug 2018 20:30:05 +0200
parents d33220d3bc27
children 98d48a5e608b
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -398,6 +398,7 @@ static void f_strdisplaywidth(typval_T *
 static void f_strwidth(typval_T *argvars, typval_T *rettv);
 static void f_submatch(typval_T *argvars, typval_T *rettv);
 static void f_substitute(typval_T *argvars, typval_T *rettv);
+static void f_swapinfo(typval_T *argvars, typval_T *rettv);
 static void f_synID(typval_T *argvars, typval_T *rettv);
 static void f_synIDattr(typval_T *argvars, typval_T *rettv);
 static void f_synIDtrans(typval_T *argvars, typval_T *rettv);
@@ -859,6 +860,7 @@ static struct fst
     {"strwidth",	1, 1, f_strwidth},
     {"submatch",	1, 2, f_submatch},
     {"substitute",	4, 4, f_substitute},
+    {"swapinfo",	1, 1, f_swapinfo},
     {"synID",		3, 3, f_synID},
     {"synIDattr",	2, 3, f_synIDattr},
     {"synIDtrans",	1, 1, f_synIDtrans},
@@ -12314,6 +12316,16 @@ f_substitute(typval_T *argvars, typval_T
 }
 
 /*
+ * "swapinfo(swap_filename)" function
+ */
+    static void
+f_swapinfo(typval_T *argvars, typval_T *rettv)
+{
+    if (rettv_dict_alloc(rettv) == OK)
+	get_b0_dict(get_tv_string(argvars), rettv->vval.v_dict);
+}
+
+/*
  * "synID(lnum, col, trans)" function
  */
     static void