diff --git a/lib/autocmd-helpers.nix b/lib/autocmd-helpers.nix index d93bec42..8f83ccfc 100644 --- a/lib/autocmd-helpers.nix +++ b/lib/autocmd-helpers.nix @@ -1,8 +1,4 @@ -{ - lib, - nixvimOptions, - nixvimTypes, -}: +{ lib, helpers }: with lib; rec { autoGroupOption = types.submodule { @@ -16,34 +12,34 @@ rec { }; autoCmdOptions = { - event = nixvimOptions.mkNullOrOption (with types; either str (listOf str)) '' + event = helpers.mkNullOrOption (with types; either str (listOf str)) '' The event or events to register this autocommand. ''; - group = nixvimOptions.mkNullOrOption (with types; either str int) '' + group = helpers.mkNullOrOption (with types; either str int) '' The autocommand group name or id to match against. ''; - pattern = nixvimOptions.mkNullOrOption (with types; either str (listOf str)) '' + pattern = helpers.mkNullOrOption (with types; either str (listOf str)) '' Pattern or patterns to match literally against. ''; - buffer = nixvimOptions.mkNullOrOption types.int '' + buffer = helpers.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 = nixvimOptions.mkNullOrOption types.str '' + description = helpers.mkNullOrOption types.str '' DEPRECATED, please use `desc`. ''; - desc = nixvimOptions.mkNullOrOption types.str '' + desc = helpers.mkNullOrOption types.str '' A textual description of this autocommand. ''; - callback = nixvimOptions.mkNullOrOption (with types; either str nixvimTypes.rawLua) '' + callback = helpers.mkNullOrOption (with types; either str helpers.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. @@ -67,13 +63,13 @@ rec { } ''; - command = nixvimOptions.defaultNullOpts.mkStr "" '' + command = helpers.defaultNullOpts.mkStr "" '' Vim command to execute on event. Cannot be used with `callback`. ''; - once = nixvimOptions.defaultNullOpts.mkBool false "Run the autocommand only once."; + once = helpers.defaultNullOpts.mkBool false "Run the autocommand only once."; - nested = nixvimOptions.defaultNullOpts.mkBool false "Run nested autocommands."; + nested = helpers.defaultNullOpts.mkBool false "Run nested autocommands."; }; autoCmdOption = types.submodule { options = autoCmdOptions; }; diff --git a/lib/helpers.nix b/lib/helpers.nix index 93037804..b2ad7917 100644 --- a/lib/helpers.nix +++ b/lib/helpers.nix @@ -5,30 +5,21 @@ ... }: let - nixvimBuilders = import ./builders.nix { inherit lib pkgs; }; - nixvimTypes = import ./types.nix { inherit lib nixvimOptions; }; - nixvimUtils = import ./utils.nix { inherit lib nixvimTypes _nixvimTests; }; - nixvimOptions = import ./options.nix { inherit lib nixvimTypes nixvimUtils; }; - nixvimDeprecation = import ./deprecation.nix { inherit lib; }; + # Build helpers recursively + helpers = + { + autocmd = import ./autocmd-helpers.nix { inherit lib helpers; }; + keymaps = import ./keymap-helpers.nix { inherit lib helpers; }; + lua = import ./to-lua.nix { inherit lib; }; + toLuaObject = helpers.lua.toLua; + maintainers = import ./maintainers.nix; + neovim-plugin = import ./neovim-plugin.nix { inherit lib helpers; }; + nixvimTypes = import ./types.nix { inherit lib helpers; }; + vim-plugin = import ./vim-plugin.nix { inherit lib helpers; }; + } + // import ./builders.nix { inherit lib pkgs; } + // import ./deprecation.nix { inherit lib; } + // import ./options.nix { inherit lib helpers; } + // import ./utils.nix { inherit lib helpers _nixvimTests; }; in -rec { - maintainers = import ./maintainers.nix; - lua = import ./to-lua.nix { inherit lib; }; - keymaps = import ./keymap-helpers.nix { inherit lib nixvimOptions nixvimTypes; }; - autocmd = import ./autocmd-helpers.nix { inherit lib nixvimOptions nixvimTypes; }; - neovim-plugin = import ./neovim-plugin.nix { - inherit - lib - nixvimOptions - nixvimUtils - toLuaObject - ; - }; - vim-plugin = import ./vim-plugin.nix { inherit lib nixvimOptions nixvimUtils; }; - inherit nixvimTypes; - toLuaObject = lua.toLua; -} -// nixvimUtils -// nixvimOptions -// nixvimBuilders -// nixvimDeprecation +helpers diff --git a/lib/keymap-helpers.nix b/lib/keymap-helpers.nix index 0bc54cd1..0d5dc5f5 100644 --- a/lib/keymap-helpers.nix +++ b/lib/keymap-helpers.nix @@ -1,29 +1,25 @@ -{ - lib, - nixvimOptions, - nixvimTypes, -}: +{ lib, helpers }: with lib; rec { # These are the configuration options that change the behavior of each mapping. mapConfigOptions = { - silent = nixvimOptions.defaultNullOpts.mkBool false "Whether this mapping should be silent. Equivalent to adding `` to a map."; + silent = helpers.defaultNullOpts.mkBool false "Whether this mapping should be silent. Equivalent to adding `` to a map."; - nowait = nixvimOptions.defaultNullOpts.mkBool false "Whether to wait for extra input on ambiguous mappings. Equivalent to adding `` to a map."; + nowait = helpers.defaultNullOpts.mkBool false "Whether to wait for extra input on ambiguous mappings. Equivalent to adding `` to a map."; - script = nixvimOptions.defaultNullOpts.mkBool false "Equivalent to adding `