mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 23:08:16 +00:00
viml: introduce menu_get() function #6322
menu_get({path}, {modes}). See :h menu_get.
This commit is contained in:

committed by
Justin M. Keyes

parent
e6d54407ba
commit
dc685387a3
@@ -47,6 +47,7 @@
|
||||
#include "nvim/mbyte.h"
|
||||
#include "nvim/memline.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/menu.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/misc1.h"
|
||||
#include "nvim/keymap.h"
|
||||
@@ -8173,6 +8174,19 @@ static void f_expand(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// "menu_get(path [, modes])" function
|
||||
static void f_menu_get(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
{
|
||||
tv_list_alloc_ret(rettv);
|
||||
int modes = MENU_ALL_MODES;
|
||||
if (argvars[1].v_type == VAR_STRING) {
|
||||
const char_u *const strmodes = (char_u *)tv_get_string(&argvars[1]);
|
||||
modes = get_menu_cmd_modes(strmodes, false, NULL, NULL);
|
||||
}
|
||||
menu_get((char_u *)tv_get_string(&argvars[0]), modes, rettv->vval.v_list);
|
||||
}
|
||||
|
||||
/*
|
||||
* "extend(list, list [, idx])" function
|
||||
* "extend(dict, dict [, action])" function
|
||||
|
Reference in New Issue
Block a user