0

I have a popup_menu. I want to have the second, for example, option chosen when it opens, rather than the first.

Is this possible? I've looked in various threads on the internet and :help popup and found nothing. But I thought it would be worthwhile to ask here.

1 Answer 1

2

All of the popup creation functions return a window ID. So save the return value of popup_menu...

    let popid = popup_menu(...)

Then use that to reach into the popup buffer and move the cursor...

    call win_execute(popid, 'call cursor(2, 1)')

win_execute() is like execute() but operates in the context of a specified window.

This is mentioned at the end of :h popup-buffer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.