-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
neovim/init: add autocommand & autogroup APIs #656
base: main
Are you sure you want to change the base?
Conversation
b3b832f
to
aa28e2a
Compare
aa28e2a
to
4afb2cc
Compare
4afb2cc
to
e41d2a4
Compare
callback = mkOption { | ||
type = nullOr luaInline; | ||
default = null; | ||
example = '' |
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.
perhaps add the lib.generators.mkLuaInline
part?
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.
or make it a string and use apply
to auto luaInline it
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 pretty sure null
is converted to Lua correctly, and luaInline
contains appropriate type-checking for non-null cases. Does this really need changing? I can't think of an edge case not caught by the current type.
|
||
assertions = [ | ||
{ | ||
assertion = builtins.all (cmd: !(cmd.command != null && cmd.callback != null)) cfg.autocmds; |
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 it required to have exactly one of them? if so, please use an xor
if not, I'd prefer cmd.command == null || cmd.callback == null
but this is more a style nitpick
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.
Technically you can have an autocommand without either, but it doesn't make sense to.
Adds
vim.augroups
andvim.autocmds
as Nix-native APIs for defining autocommands and autogroups in Nix. The implementation is a bit hacky, and relies on Lua instead of Nix for resolving auto{cmd,group} tables but should work as intended. Basic testing yields no errors, but I'll know for sure after I convert all of my autocommands to the new format.