Skip to content

What's the minwid in on_click ? What does it mean? #158

Answered by rebelot
bew asked this question in Q&A
Discussion options

You must be logged in to vote

Vim will call the function specified with the syntax %N@SomeFunc@label%X when clicking on label. The call will be made with the signature SomeFunc(minwid, nclicks, mbutton, mods). I have no control on how the call is made, and arbitrarily changing the signature because "it makes little sense to me", makes little sense to me. Also, SomeFunc must be a global function, this is the main caveat! If multiple lua closures are registered with the name SomeFunc, each one will overwrite the previous one, hence each closure should have a different name, hugely polluting the global namespace. Another possibility is to add each closure to a global table, and the callback function simply uses minwid to…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@bew
Comment options

@rebelot
Comment options

Answer selected by bew
@rebelot
Comment options

@bew
Comment options

@rebelot
Comment options

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