nix-community.nixvim/lib/helpers.nix

102 lines
2.3 KiB
Nix
Raw Normal View History

{
pkgs,
lib ? pkgs.lib,
_nixvimTests ? false,
...
2024-05-05 19:39:35 +02:00
}:
let
# Used when importing parts of helpers
call = lib.callPackageWith {
# TODO: deprecate/remove using `helpers` in the subsections
2024-08-03 16:28:41 +01:00
inherit call pkgs helpers;
lib = helpers.extendedLib;
};
2024-07-28 22:30:11 +01:00
# Build helpers recursively
helpers = {
autocmd = call ./autocmd-helpers.nix { };
builders = call ./builders.nix { };
deprecation = call ./deprecation.nix { };
extendedLib = call ./extend-lib.nix { inherit lib; };
keymaps = call ./keymap-helpers.nix { };
lua = call ./to-lua.nix { };
modules = call ./modules.nix { };
neovim-plugin = call ./neovim-plugin.nix { };
options = call ./options.nix { };
utils = call ./utils.nix { inherit _nixvimTests; };
vim-plugin = call ./vim-plugin.nix { };
# Top-level helper aliases:
# TODO: deprecate some aliases
inherit (helpers.builders)
writeLua
writeByteCompiledLua
byteCompileLuaFile
byteCompileLuaHook
byteCompileLuaDrv
;
inherit (helpers.deprecation)
getOptionRecursive
mkDeprecatedSubOptionModule
mkSettingsRenamedOptionModules
transitionType
;
inherit (helpers.options)
defaultNullOpts
mkCompositeOption
mkCompositeOption'
mkNullOrLua
mkNullOrLua'
mkNullOrLuaFn
mkNullOrLuaFn'
mkNullOrOption
mkNullOrOption'
mkNullOrStr
mkNullOrStr'
mkNullOrStrLuaFnOr
mkNullOrStrLuaFnOr'
mkNullOrStrLuaOr
mkNullOrStrLuaOr'
mkPackageOption
mkPluginPackageOption
mkSettingsOption
pluginDefaultText
;
inherit (helpers.utils)
concatNonEmptyLines
emptyTable
enableExceptInTests
groupListBySize
hasContent
ifNonNull'
listToUnkeyedAttrs
mkIfNonNull
mkIfNonNull'
mkRaw
mkRawKey
override
overrideDerivation
toRawKeys
toSnakeCase
upperFirstChar
wrapDo
wrapLuaForVimscript
wrapVimscriptForLua
;
# TODO: Deprecate this `maintainers` alias
inherit (helpers.extendedLib) maintainers;
2024-08-03 16:28:41 +01:00
# TODO: Deprecate the old `nixvimTypes` alias?
nixvimTypes = helpers.extendedLib.types;
toLuaObject = helpers.lua.toLua;
mkLuaInline = helpers.lua.mkInline;
};
2024-01-25 15:43:06 +01:00
in
2024-07-28 22:30:11 +01:00
helpers