-
-
Notifications
You must be signed in to change notification settings - Fork 268
patch: Use Lua autocmd API #872
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
base: master
Are you sure you want to change the base?
Conversation
Make use of the new API implemented in neovim/neovim#14661. This API is not yet released, but will probably be released with Neovim 0.7 (see https://github.com/neovim/neovim/milestone/29). So I guess you can merge my PR when Neovim 0.7 is released? I tried out this diff on the Git master of Neovim.
|
This API will definitely be released with 0.7, which is scheduled for April 15. Be aware that until then, the API may still change! I'd recommend waiting a bit before merging this to allow people (and distros) to update (this being the Easter weekend, after all). |
README.md
Outdated
| augroup end | ||
| ]]) | ||
| ``` | ||
| This autocommand can be placed in your `init.vim`, in `plugins.lua`, or any other startup file as per your setup. |
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.
Should be init.lua, as this is Lua code.
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.
Good catch. However, I see that there are other references to init.vim in the readme. I guess it would be inconsistent if I used init.lua in this one place and the rest of the readme uses init.vim. I dropped the reference to init.vim entirely for now, I think that's probably the easiest solution.
| ``` | ||
| augroup packer_user_config | ||
| autocmd! | ||
| autocmd BufWritePost plugins.lua source <afile> | PackerCompile |
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.
is source <afile> not needed anymore?
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.
I'm not familiar with what source <afile> does. If I remember correctly I tried to find the equivalent in the lua api and there was nothing equivalent (but maybe I remember that wrong). I have the lua code in my init.lua as I wrote in this PR and it works.
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.
There is -- Lua callbacks get passed an args table, with args.file being equivalent to <afile>.
See :h nvim_create_autocmd().
Make use of the new API implemented in
neovim/neovim#14661.
This API is not yet released, but will probably be released with Neovim
0.7 (see https://github.com/neovim/neovim/milestone/29). So I guess you
can merge my PR when Neovim 0.7 is released?
I tried out this diff on the Git master of Neovim.