]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.828 v7.3.828
authorBram Moolenaar <Bram@vim.org>
Wed, 20 Feb 2013 16:59:11 +0000 (17:59 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 20 Feb 2013 16:59:11 +0000 (17:59 +0100)
Problem:    Mappings are not aware of wildmenu mode.
Solution:   Add wildmenumode(). (Christian Brabandt)

runtime/doc/eval.txt
src/eval.c
src/version.c

index b1748c16a1c8eabbfbaf64a8bd190fa4280dceba..6e8fa13a7433d9b0b4ed5096487f6ff71f515d2a 100644 (file)
@@ -1993,6 +1993,7 @@ undotree()                        List    undo file tree
 values( {dict})                        List    values in {dict}
 virtcol( {expr})               Number  screen column of cursor or mark
 visualmode( [expr])            String  last visual mode used
+wildmenumode()                 Number  whether 'wildmenu' mode is active
 winbufnr( {nr})                        Number  buffer number of window {nr}
 wincol()                       Number  window column of the cursor
 winheight( {nr})               Number  height of window {nr}
@@ -6162,6 +6163,18 @@ visualmode([expr])                                               *visualmode()*
                Dictionary or Float is not a Number or String, thus does not
                cause the mode to be cleared.
 
+wildmenumode()                                 *wildmenumode()*
+               Returns non-zero when the wildmenu is active and zero
+               otherwise.  See 'wildmenu' and 'wildmode'.
+               This can be used in mappings to handle the 'wildcharm' option
+               gracefully. (Makes only sense with |mapmode-c| mappings).
+
+               For example to make <c-j> work like <down> in wildmode, use: >
+    :cnoremap <expr> <C-j> wildmenumode() ? "\<Down>\<Tab>" : "\<c-j>"
+<
+               (Note, this needs the 'wildcharm' option set appropriately).
+
+
                                                        *winbufnr()*
 winbufnr({nr}) The result is a Number, which is the number of the buffer
                associated with window {nr}.  When {nr} is zero, the number of
index bc41805e952acc567cd24fdd9b96c3ec8d1fafcf..e1f29c40f5e242da8e85d8fbb02c18e713addd59 100644 (file)
@@ -751,6 +751,7 @@ static void f_undotree __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_values __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_virtcol __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_visualmode __ARGS((typval_T *argvars, typval_T *rettv));
+static void f_wildmenumode __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_winbufnr __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_wincol __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_winheight __ARGS((typval_T *argvars, typval_T *rettv));
@@ -8121,6 +8122,7 @@ static struct fst
     {"values",         1, 1, f_values},
     {"virtcol",                1, 1, f_virtcol},
     {"visualmode",     0, 1, f_visualmode},
+    {"wildmenumode",   0, 0, f_wildmenumode},
     {"winbufnr",       1, 1, f_winbufnr},
     {"wincol",         0, 0, f_wincol},
     {"winheight",      1, 1, f_winheight},
@@ -18576,6 +18578,20 @@ f_visualmode(argvars, rettv)
 #endif
 }
 
+/*
+ * "wildmenumode()" function
+ */
+    static void
+f_wildmenumode(argvars, rettv)
+    typval_T   *argvars UNUSED;
+    typval_T   *rettv UNUSED;
+{
+#ifdef FEAT_WILDMENU
+    if (wild_menu_showing)
+       rettv->vval.v_number = 1;
+#endif
+}
+
 /*
  * "winbufnr(nr)" function
  */
index 204b7a173e3ced2aaca45e3faa0d2f8054f09542..71e10153c8f3cc22a32949426efcd716aa4281b9 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    828,
 /**/
     827,
 /**/