diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 7e4c202b..7d24163e 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -6,7 +6,7 @@ inherit (lib.options) mkOption; inherit (lib.attrsets) attrNames mapAttrs' filterAttrs nameValuePair; inherit (lib.strings) hasPrefix removePrefix; - inherit (lib.types) submodule either package enum str lines attrsOf anything listOf nullOr oneOf bool int; + inherit (lib.types) submodule either package enum str lines attrsOf anything listOf nullOr; # Get the names of all flake inputs that start with the given prefix. fromInputs = { @@ -53,190 +53,6 @@ }; borderPresets = ["none" "single" "double" "rounded" "solid" "shadow"]; - luaInline = lib.mkOptionType { - name = "luaInline"; - check = x: lib.nvim.lua.isLuaInline x; - }; - - lznKeysSpec = submodule { - options = { - desc = mkOption { - description = "Description of the key map"; - type = nullOr str; - default = null; - }; - - noremap = mkOption { - description = "TBD"; - type = bool; - default = false; - }; - - expr = mkOption { - description = "TBD"; - type = bool; - default = false; - }; - - nowait = mkOption { - description = "TBD"; - type = bool; - default = false; - }; - - ft = mkOption { - description = "TBD"; - type = nullOr (listOf str); - default = null; - }; - - key = mkOption { - type = str; - description = "Key to bind to"; - }; - - action = mkOption { - type = nullOr str; - default = null; - description = "Action to trigger."; - }; - - lua = mkOption { - type = bool; - default = false; - description = "If true the action is treated as a lua function instead of a vim command."; - }; - - mode = mkOption { - description = "Modes to bind in"; - type = listOf str; - default = ["n" "x" "s" "o"]; - }; - }; - }; - - lznPluginTableType = attrsOf lznPluginType; - lznPluginType = submodule { - options = { - ## Should probably infer from the actual plugin somehow - ## In general this is the name passed to packadd, so the dir name of the plugin - # name = mkOption { - # type= str; - # } - - # Non-lz.n options - - package = mkOption { - type = pluginType; - description = "Plugin package"; - }; - - setupModule = mkOption { - type = nullOr str; - description = "Lua module to run setup function on."; - default = null; - }; - - setupOpts = mkOption { - type = submodule {freeformType = attrsOf anything;}; - description = "Options to pass to the setup function"; - default = {}; - }; - - # lz.n options - - enabled = mkOption { - type = nullOr (either bool str); - description = "When false, or if the lua function returns false, this plugin will not be included in the spec"; - default = null; - }; - - beforeAll = mkOption { - type = nullOr str; - description = "Lua code to run before any plugins are loaded. This will be wrapped in a function."; - default = null; - }; - - before = mkOption { - type = nullOr str; - description = "Lua code to run before plugin is loaded. This will be wrapped in a function."; - default = null; - }; - - after = mkOption { - type = nullOr str; - description = "Lua code to run after plugin is loaded. This will be wrapped in a function."; - default = null; - }; - - event = mkOption { - description = "Lazy-load on event"; - default = null; - type = let - event = submodule { - options = { - event = mkOption { - type = nullOr (either str (listOf str)); - description = "Exact event name"; - example = "BufEnter"; - }; - pattern = mkOption { - type = nullOr (either str (listOf str)); - description = "Event pattern"; - example = "BufEnter *.lua"; - }; - }; - }; - in - nullOr (oneOf [str (listOf str) event]); - }; - - cmd = mkOption { - description = "Lazy-load on command"; - default = null; - type = nullOr (either str (listOf str)); - }; - - ft = mkOption { - description = "Lazy-load on filetype"; - default = null; - type = nullOr (either str (listOf str)); - }; - - keys = mkOption { - description = "Lazy-load on key mapping"; - default = null; - type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]); - example = '' - keys = [ - {lhs = "s"; rhs = ":NvimTreeToggle"; desc = "Toggle NvimTree"} - ] - ''; - }; - - colorscheme = mkOption { - description = "Lazy-load on colorscheme."; - type = nullOr (either str (listOf str)); - default = null; - }; - - priority = mkOption { - type = nullOr int; - description = "Only useful for stat plugins (not lazy-loaded) to force loading certain plugins first."; - default = null; - }; - - load = mkOption { - type = nullOr str; - default = null; - description = '' - Lua code to override the `vim.g.lz_n.load()` function for a single plugin. - - This will be wrapped in a function - ''; - }; - }; - }; in { inherit extraPluginType fromInputs pluginType;