diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-04 14:48:34 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-08-05 06:47:24 +0800 |
commit | 5170a4a3692a53b1cc3f269f81e329f1757e33e9 (patch) | |
tree | 21ccd16aca2fbae823fa67b64d85b7861e09864c /runtime/doc | |
parent | 93649cefab4d6864f21a1278e4cde076daf6adbc (diff) | |
download | rneovim-5170a4a3692a53b1cc3f269f81e329f1757e33e9.tar.gz rneovim-5170a4a3692a53b1cc3f269f81e329f1757e33e9.tar.bz2 rneovim-5170a4a3692a53b1cc3f269f81e329f1757e33e9.zip |
vim-patch:8.2.3459: Vim9: need more tests for empty string arguments
Problem: Vim9: need more tests for empty string arguments.
Solution: Add more tests. Also use empty argument with menu_info() to get
the top-level menu names. (Yegappan Lakshmanan, closes vim/vim#8925)
https://github.com/vim/vim/commit/51491adfa86fd66a857cd7ec50d0b57dbdf3da59
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/builtin.txt | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 455fe69f6a..c56ab70774 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -5259,7 +5259,8 @@ menu_get({path} [, {modes}]) *menu_get()* menu_info({name} [, {mode}]) *menu_info()* Return information about the specified menu {name} in mode {mode}. The menu name should be specified without the - shortcut character ('&'). + shortcut character ('&'). If {name} is "", then the top-level + menu names are returned. {mode} can be one of these strings: "n" Normal @@ -5310,6 +5311,20 @@ menu_info({name} [, {mode}]) *menu_info()* Examples: > :echo menu_info('Edit.Cut') :echo menu_info('File.Save', 'n') + + " Display the entire menu hierarchy in a buffer + func ShowMenu(name, pfx) + let m = menu_info(a:name) + call append(line('$'), a:pfx .. m.display) + for child in m->get('submenus', []) + call ShowMenu(a:name .. '.' .. escape(child, '.'), + \ a:pfx .. ' ') + endfor + endfunc + new + for topmenu in menu_info('').submenus + call ShowMenu(topmenu, '') + endfor < Can also be used as a |method|: > GetMenuName()->menu_info('v') |