I want to get a list of all installed color schemes when I am trying to change
color scheme automatically.
The function returns a list of all color schemes
Patch attached.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/eval.c b/src/eval.c
index c9c179a..c85b867 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -494,6 +494,7 @@ static void f_char2nr __ARGS((typval_T *argvars, typval_T *rettv));
static void f_cindent __ARGS((typval_T *argvars, typval_T *rettv));
static void f_clearmatches __ARGS((typval_T *argvars, typval_T *rettv));
static void f_col __ARGS((typval_T *argvars, typval_T *rettv));
+static void f_colorschemes __ARGS((typval_T *argvars, typval_T *rettv));
#if defined(FEAT_INS_EXPAND)
static void f_complete __ARGS((typval_T *argvars, typval_T *rettv));
static void f_complete_add __ARGS((typval_T *argvars, typval_T *rettv));
@@ -7953,6 +7954,7 @@ static struct fst
{"cindent", 1, 1, f_cindent},
{"clearmatches", 0, 0, f_clearmatches},
{"col", 1, 1, f_col},
+ {"colorschemes", 0, 0, f_colorschemes},
#if defined(FEAT_INS_EXPAND)
{"complete", 2, 2, f_complete},
{"complete_add", 1, 1, f_complete_add},
@@ -16325,6 +16327,26 @@ f_screenrow(argvars, rettv)
}
/*
+ * "colorschemes()" function
+ */
+ static void
+f_colorschemes(argvars, rettv)
+ typval_T *argvars UNUSED;
+ typval_T *rettv;
+{
+ expand_T xpc;
+ ExpandInit(&xpc);
+ xpc.xp_context = EXPAND_COLORS;
+ if (rettv_list_alloc(rettv) != FAIL) {
+ int i;
+ ExpandOne(&xpc, "", NULL, WILD_SILENT, WILD_KEEP_ALL);
+ for (i = 0; i < xpc.xp_numfiles; i++)
+ list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1);
+ ExpandCleanup(&xpc);
+ }
+}
+
+/*
* "search()" function
*/
static void