On 18:48 Mon 03 Feb , Marcin Szamotulski wrote:
> Hello,
>
> I wrote a small patch which adds argisglobal() function which returns
> 1 if the current buffer has global arglist otherwise, if there is
> a local arg list it return 0. I haven't found any other way to test if
> the arglist is gobal/local.
>
> I've been using this patch for some time already (I have a plugin
> http://www.vim.org/scripts/script.php?script_id=4681 which is using it)
> and it works fine.
>
> Best regards,
> Marcin Szamotulski
and here is the patch which I've forgotten to attach.
Best regards,
Marcin Szamotulski
--
--
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/groups/opt_out.
diff -r a83960ec9e6d -r c535a1c9985e src/eval.c
--- a/src/eval.c Sun Sep 08 20:00:48 2013 +0200
+++ b/src/eval.c Sat Sep 14 22:25:44 2013 +0100
@@ -459,6 +459,7 @@
static void f_append __ARGS((typval_T *argvars, typval_T *rettv));
static void f_argc __ARGS((typval_T *argvars, typval_T *rettv));
static void f_argidx __ARGS((typval_T *argvars, typval_T *rettv));
+static void f_argisglobal __ARGS((typval_T *argvars, typval_T *rettv));
static void f_argv __ARGS((typval_T *argvars, typval_T *rettv));
#ifdef FEAT_FLOAT
static void f_asin __ARGS((typval_T *argvars, typval_T *rettv));
@@ -7841,6 +7842,7 @@
{"append", 2, 2, f_append},
{"argc", 0, 0, f_argc},
{"argidx", 0, 0, f_argidx},
+ {"argisglobal", 0, 0, f_argisglobal},
{"argv", 0, 1, f_argv},
#ifdef FEAT_FLOAT
{"asin", 1, 1, f_asin}, /* WJMc */
@@ -8814,6 +8816,20 @@
}
/*
+ * "argisglobal()" function
+ */
+ static void
+f_argisglobal(argvars, rettv)
+ typval_T *argvars UNUSED;
+ typval_T *rettv;
+{
+ if (curwin->w_alist == &global_alist)
+ rettv->vval.v_number = 1;
+ else
+ rettv->vval.v_number = 0;
+}
+
+/*
* "argv(nr)" function
*/
static void