0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

updated for version 7.3.828

Problem:    Mappings are not aware of wildmenu mode.
Solution:   Add wildmenumode(). (Christian Brabandt)
This commit is contained in:
Bram Moolenaar
2013-02-20 17:59:11 +01:00
parent 995a8cd181
commit 8738fc1be8
3 changed files with 31 additions and 0 deletions

View File

@@ -1993,6 +1993,7 @@ undotree() List undo file tree
values( {dict}) List values in {dict} values( {dict}) List values in {dict}
virtcol( {expr}) Number screen column of cursor or mark virtcol( {expr}) Number screen column of cursor or mark
visualmode( [expr]) String last visual mode used visualmode( [expr]) String last visual mode used
wildmenumode() Number whether 'wildmenu' mode is active
winbufnr( {nr}) Number buffer number of window {nr} winbufnr( {nr}) Number buffer number of window {nr}
wincol() Number window column of the cursor wincol() Number window column of the cursor
winheight( {nr}) Number height of window {nr} 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 Dictionary or Float is not a Number or String, thus does not
cause the mode to be cleared. 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()*
winbufnr({nr}) The result is a Number, which is the number of the buffer 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 associated with window {nr}. When {nr} is zero, the number of

View 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_values __ARGS((typval_T *argvars, typval_T *rettv));
static void f_virtcol __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_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_winbufnr __ARGS((typval_T *argvars, typval_T *rettv));
static void f_wincol __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)); static void f_winheight __ARGS((typval_T *argvars, typval_T *rettv));
@@ -8121,6 +8122,7 @@ static struct fst
{"values", 1, 1, f_values}, {"values", 1, 1, f_values},
{"virtcol", 1, 1, f_virtcol}, {"virtcol", 1, 1, f_virtcol},
{"visualmode", 0, 1, f_visualmode}, {"visualmode", 0, 1, f_visualmode},
{"wildmenumode", 0, 0, f_wildmenumode},
{"winbufnr", 1, 1, f_winbufnr}, {"winbufnr", 1, 1, f_winbufnr},
{"wincol", 0, 0, f_wincol}, {"wincol", 0, 0, f_wincol},
{"winheight", 1, 1, f_winheight}, {"winheight", 1, 1, f_winheight},
@@ -18576,6 +18578,20 @@ f_visualmode(argvars, rettv)
#endif #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 * "winbufnr(nr)" function
*/ */

View File

@@ -728,6 +728,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
828,
/**/ /**/
827, 827,
/**/ /**/