diff src/option.c @ 9858:3e96d9ed2ca1 v7.4.2204

commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 12 22:23:25 2016 +0200 patch 7.4.2204 Problem: It is not easy to get information about buffers, windows and tabpages. Solution: Add getbufinfo(), getwininfo() and gettabinfo(). (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Fri, 12 Aug 2016 22:30:07 +0200
parents eed41404e383
children 989d44d35a66
line wrap: on
line diff
--- a/src/option.c
+++ b/src/option.c
@@ -12329,3 +12329,40 @@ signcolumn_on(win_T *wp)
 		    );
 }
 #endif
+
+#if defined(FEAT_EVAL) || defined(PROTO)
+/*
+ * Get window or buffer local options.
+ */
+    dict_T *
+get_winbuf_options(int bufopt)
+{
+    dict_T	*d;
+    int		opt_idx;
+
+    d = dict_alloc();
+    if (d == NULL)
+	return NULL;
+
+    for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++)
+    {
+	struct vimoption *opt = &options[opt_idx];
+
+	if ((bufopt && (opt->indir & PV_BUF))
+					 || (!bufopt && (opt->indir & PV_WIN)))
+	{
+	    char_u *varp = get_varp(opt);
+
+	    if (varp != NULL)
+	    {
+		if (opt->flags & P_STRING)
+		    dict_add_nr_str(d, opt->fullname, 0L, *(char_u **)varp);
+		else
+		    dict_add_nr_str(d, opt->fullname, *varp, NULL);
+	    }
+	}
+    }
+
+    return d;
+}
+#endif