Skip to content

Guidance on Dynamically Generating Sub-menus #301

Closed Answered by tarsius
kickingvegas asked this question in Q&A
Discussion options

You must be logged in to vote

I was actually thinking more in line with sub-menus being “real menus” (implemented as prefixes).

So my second alternative.

Your question then is "how can I dynamically define prefix commands?", I suppose.

You shouldn't do that, not in :setup-children, or elsewhere. Probably.

emoji-insert used to do that, before I refactored it. The new implementation does not dynamically define new commands, instead it binds the same pre-defined commands many times and makes each instance behave differently by using a different value for the :scope in the dynamically generated binding as suffix. (And that recursively, which won't be necessary here.)

In this case you probably would only want all the "Ex…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@tarsius
Comment options

Answer selected by tarsius
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants