-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change nvim_create_autocmd callback to a lambda #1295
Change nvim_create_autocmd callback to a lambda #1295
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callback in vim.api.nvim_create_autocmd() seems to require a lambda.
Can you be a bit more specific - are you suggesting that auto-formatting is not triggered without the lambda, or that you get an error?
I'm not that familiar with Lua or Vim, but the two snippets of code seem equivalent to me so I'm somewhat surprised if this makes a difference.
I was getting an error and went to check the lua documentation which uses a lua function as parameter for the callback (or a string if it's a VimScript function name): https://neovim.io/doc/user/api.html#nvim_create_autocmd() I'm not that familiar with lua either but it seems to me we're assigning the result returned by the function to the callback in the original snippet, instead of the function itself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems to me we're assigning the result returned by the function to the callback in the original snippet, instead of the function itself
That looks like a plausible explanation which I'm going to trust 😅 Thanks for this extra context.
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Related to #1140
callback
invim.api.nvim_create_autocmd()
seems to require a lambda.I didn't test it for VimScript or Neovim v0.5.0+ so I didn't change it for these.