From 304c62516daf60180aaefd3f8a5610bc278fa568 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 9 Feb 2024 14:56:49 +0100 Subject: [PATCH] helpers/autocmd-helpers: do not import helpers.nix directly --- lib/autocmd-helpers.nix | 30 ++++++++++++++++-------------- lib/helpers.nix | 2 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/autocmd-helpers.nix b/lib/autocmd-helpers.nix index 29bee131..98791802 100644 --- a/lib/autocmd-helpers.nix +++ b/lib/autocmd-helpers.nix @@ -1,7 +1,9 @@ -{lib, ...}: -with lib; let - helpers = import ../lib/helpers.nix {inherit lib;}; -in rec { +{ + lib, + nixvimOptions, + nixvimTypes, +}: +with lib; rec { autoGroupOption = types.submodule { options = { clear = mkOption { @@ -13,34 +15,34 @@ in rec { }; 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. ''; - 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. ''; - 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. ''; - buffer = helpers.mkNullOrOption types.int '' + buffer = nixvimOptions.mkNullOrOption types.int '' Buffer number for buffer local autocommands |autocmd-buflocal|. Cannot be used with `pattern`. ''; # Introduced early October 2023. # TODO remove in early December 2023. - description = helpers.mkNullOrOption types.str '' + description = nixvimOptions.mkNullOrOption types.str '' DEPRECATED, please use `desc`. ''; - desc = helpers.mkNullOrOption types.str '' + desc = nixvimOptions.mkNullOrOption types.str '' 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. - 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. @@ -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`. ''; - 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 { diff --git a/lib/helpers.nix b/lib/helpers.nix index 06518c19..020c3362 100644 --- a/lib/helpers.nix +++ b/lib/helpers.nix @@ -6,7 +6,7 @@ in { maintainers = import ./maintainers.nix; 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;}; vim-plugin = import ./vim-plugin.nix {inherit lib nixvimOptions;}; inherit (import ./to-lua.nix {inherit lib;}) toLuaObject;