helpers/autocmd-helpers: do not import helpers.nix directly

This commit is contained in:
Gaetan Lepage 2024-02-09 14:56:49 +01:00 committed by Gaétan Lepage
parent ba818894b4
commit 304c62516d
2 changed files with 17 additions and 15 deletions

View file

@ -1,7 +1,9 @@
{lib, ...}: {
with lib; let lib,
helpers = import ../lib/helpers.nix {inherit lib;}; nixvimOptions,
in rec { nixvimTypes,
}:
with lib; rec {
autoGroupOption = types.submodule { autoGroupOption = types.submodule {
options = { options = {
clear = mkOption { clear = mkOption {
@ -13,34 +15,34 @@ in rec {
}; };
autoCmdOptions = { autoCmdOptions = {
event = helpers.mkNullOrOption (with types; either str (listOf str)) '' event = nixvimOptions.mkNullOrOption (with types; either str (listOf str)) ''
The event or events to register this autocommand. The event or events to register this autocommand.
''; '';
group = helpers.mkNullOrOption (with types; either str int) '' group = nixvimOptions.mkNullOrOption (with types; either str int) ''
The autocommand group name or id to match against. The autocommand group name or id to match against.
''; '';
pattern = helpers.mkNullOrOption (with types; either str (listOf str)) '' pattern = nixvimOptions.mkNullOrOption (with types; either str (listOf str)) ''
Pattern or patterns to match literally against. Pattern or patterns to match literally against.
''; '';
buffer = helpers.mkNullOrOption types.int '' buffer = nixvimOptions.mkNullOrOption types.int ''
Buffer number for buffer local autocommands |autocmd-buflocal|. Buffer number for buffer local autocommands |autocmd-buflocal|.
Cannot be used with `pattern`. Cannot be used with `pattern`.
''; '';
# Introduced early October 2023. # Introduced early October 2023.
# TODO remove in early December 2023. # TODO remove in early December 2023.
description = helpers.mkNullOrOption types.str '' description = nixvimOptions.mkNullOrOption types.str ''
DEPRECATED, please use `desc`. DEPRECATED, please use `desc`.
''; '';
desc = helpers.mkNullOrOption types.str '' desc = nixvimOptions.mkNullOrOption types.str ''
A textual description of this autocommand. A textual description of this autocommand.
''; '';
callback = helpers.mkNullOrOption (with types; either str helpers.nixvimTypes.rawLua) '' callback = nixvimOptions.mkNullOrOption (with types; either str nixvimTypes.rawLua) ''
A function or a string. A function or a string.
- if a string, the name of a Vimscript function to call when this autocommand is triggered. - if a string, the name of a Vimscript function to call when this autocommand is triggered.
- Otherwise, a Lua function which is called when this autocommand is triggered. - Otherwise, a Lua function which is called when this autocommand is triggered.
@ -64,13 +66,13 @@ in rec {
} }
''; '';
command = helpers.defaultNullOpts.mkStr "" '' command = nixvimOptions.defaultNullOpts.mkStr "" ''
Vim command to execute on event. Cannot be used with `callback`. Vim command to execute on event. Cannot be used with `callback`.
''; '';
once = helpers.defaultNullOpts.mkBool false "Run the autocommand only once."; once = nixvimOptions.defaultNullOpts.mkBool false "Run the autocommand only once.";
nested = helpers.defaultNullOpts.mkBool false "Run nested autocommands."; nested = nixvimOptions.defaultNullOpts.mkBool false "Run nested autocommands.";
}; };
autoCmdOption = types.submodule { autoCmdOption = types.submodule {

View file

@ -6,7 +6,7 @@ in
{ {
maintainers = import ./maintainers.nix; maintainers = import ./maintainers.nix;
keymaps = import ./keymap-helpers.nix {inherit lib nixvimOptions nixvimTypes;}; keymaps = import ./keymap-helpers.nix {inherit lib nixvimOptions nixvimTypes;};
autocmd = import ./autocmd-helpers.nix {inherit lib;}; autocmd = import ./autocmd-helpers.nix {inherit lib nixvimOptions nixvimTypes;};
neovim-plugin = import ./neovim-plugin.nix {inherit lib nixvimOptions;}; neovim-plugin = import ./neovim-plugin.nix {inherit lib nixvimOptions;};
vim-plugin = import ./vim-plugin.nix {inherit lib nixvimOptions;}; vim-plugin = import ./vim-plugin.nix {inherit lib nixvimOptions;};
inherit (import ./to-lua.nix {inherit lib;}) toLuaObject; inherit (import ./to-lua.nix {inherit lib;}) toLuaObject;