While has("menu") can tell me if gvim will support the menu command, is there a way to test in vim script if any menu currently exists?
The closest thing that I could figure out is to execute the :menu command and count the output. For example, in rough pseudo code…
if count(":menu") != '0'
" something has created a menu and is visible on screen
else
" no menus have been created
endif
Your request is unusual; that’s why menu items probably aren’t covered by
exists()or a function analog tomaparg().You have to do this as outlined in your pseudo code:
PS: Overreliance on menus is a Vim “smell”; for one, you don’t have them (easily accessible) when using console Vim.