diff --git a/flake.lock b/flake.lock index ddae387..da9a8ff 100644 --- a/flake.lock +++ b/flake.lock @@ -805,11 +805,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1689759503, - "narHash": "sha256-wFrcae6V58hIlDW+7NDoUXzXBmsU7W/k3V1KIePcwRA=", + "lastModified": 1699423608, + "narHash": "sha256-WEVUgivm5DCziwZqiXRPeoD3FQTXW38ExKrZjvMveqE=", "owner": "oxalica", "repo": "nil", - "rev": "59bcad0b13b5d77668c0c125fef71d7b41406d7a", + "rev": "5607d429016d6f9a72843b07127fad23ea9d661f", "type": "github" }, "original": { @@ -1583,11 +1583,11 @@ ] }, "locked": { - "lastModified": 1688783586, - "narHash": "sha256-HHaM2hk2azslv1kH8zmQxXo2e7i5cKgzNIuK4yftzB0=", + "lastModified": 1696817516, + "narHash": "sha256-Xt9OY4Wnk9/vuUfA0OHFtmSlaen5GyiS9msgwOz3okI=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "7a29283cc242c2486fc67f60b431ef708046d176", + "rev": "c0df7f2a856b5ff27a3ce314f6d7aacf5fda546f", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 9196ec8..25ce941 100644 --- a/flake.nix +++ b/flake.nix @@ -38,12 +38,19 @@ }; perSystem = { + self', config, pkgs, ... }: { - devShells.default = pkgs.mkShell {nativeBuildInputs = [config.packages.nix];}; formatter = pkgs.alejandra; + devShells = { + default = self'.devShells.lsp; + nvim-nix = pkgs.mkShell {nativeBuildInputs = [config.packages.nix];}; + lsp = pkgs.mkShell { + nativeBuildInputs = with pkgs; [nil statix deadnix]; + }; + }; }; }; diff --git a/lib/default.nix b/lib/default.nix index 2bdaab6..9a1d7f3 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -4,4 +4,5 @@ types = import ./types {inherit lib;}; languages = import ./languages.nix {inherit lib;}; lua = import ./lua.nix {inherit lib;}; + vim = import ./vim.nix {inherit lib;}; } diff --git a/lib/lua.nix b/lib/lua.nix index d888d3f..55e22d3 100644 --- a/lib/lua.nix +++ b/lib/lua.nix @@ -1,11 +1,8 @@ # Helpers for converting values to lua -{lib}: rec { - # yes? no. - yesNo = value: - if value - then "yes" - else "no"; - +{lib}: let + inherit (lib) mapAttrsToList filterAttrs concatStringsSep concatMapStringsSep stringToCharacters boolToString; + inherit (builtins) hasAttr head; +in rec { # Convert a null value to lua's nil nullString = value: if value == null @@ -46,4 +43,44 @@ + " }"; # Convert a list of lua expressions to a lua table. The difference to listToLuaTable is that the elements here are expected to be lua expressions already, whereas listToLuaTable converts from nix types to lua first luaTable = items: ''{${builtins.concatStringsSep "," items}}''; + + toLuaObject = args: + if builtins.isAttrs args + then + if hasAttr "__raw" args + then args.__raw + else if hasAttr "__empty" args + then "{ }" + else + "{" + + (concatStringsSep "," + (mapAttrsToList + (n: v: + if head (stringToCharacters n) == "@" + then toLuaObject v + else "[${toLuaObject n}] = " + (toLuaObject v)) + (filterAttrs + ( + _: v: + (v != null) && (toLuaObject v != "{}") + ) + args))) + + "}" + else if builtins.isList args + then "{" + concatMapStringsSep "," toLuaObject args + "}" + else if builtins.isString args + then + # This should be enough! + builtins.toJSON args + else if builtins.isPath args + then builtins.toJSON (toString args) + else if builtins.isBool args + then "${boolToString args}" + else if builtins.isFloat args + then "${toString args}" + else if builtins.isInt args + then "${toString args}" + else if (args != null) + then "nil" + else ""; } diff --git a/lib/vim.nix b/lib/vim.nix new file mode 100644 index 0000000..b00d7ca --- /dev/null +++ b/lib/vim.nix @@ -0,0 +1,26 @@ +{lib}: let + inherit (builtins) isInt isBool toJSON; +in rec { + # yes? no. + yesNo = value: + if value + then "yes" + else "no"; + + # convert a boolean to a vim compliant boolean string + mkVimBool = val: + if val + then "1" + else "0"; + + # convert a literal value to a vim compliant value + valToVim = val: + if (isInt val) + then (builtins.toString val) + else + ( + if (isBool val) + then (mkVimBool val) + else (toJSON val) + ); +} diff --git a/modules/assertions.nix b/modules/assertions.nix deleted file mode 100644 index 3236efa..0000000 --- a/modules/assertions.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.vim; -in { - config = { - assertions = mkMerge [ - { - assertion = cfg.kommentary.enable; - message = "Kommentary has been deprecated in favor of comments-nvim"; - } - { - assertion = cfg.utility.colorizer.enable; - message = "config.utility.colorizer has been renamed to config.utility.ccc"; - } - mkIf - (config.programs.neovim-flake.enable) - { - assertion = !config.programs.neovim.enable; - message = "You cannot use `programs.neovim-flake.enable` with `programs.neovim.enable`"; - } - ]; - }; -} diff --git a/modules/assistant/copilot/config.nix b/modules/assistant/copilot/config.nix index 349d610..18f540d 100644 --- a/modules/assistant/copilot/config.nix +++ b/modules/assistant/copilot/config.nix @@ -3,9 +3,10 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) toJSON; + inherit (lib) mkIf nvim mkLuaBinding mkMerge; + cfg = config.vim.assistant.copilot; wrapPanelBinding = luaFunction: key: '' @@ -13,7 +14,7 @@ with builtins; let local s, _ = pcall(${luaFunction}) if not s then - local termcode = vim.api.nvim_replace_termcodes(${builtins.toJSON key}, true, false, true) + local termcode = vim.api.nvim_replace_termcodes(${toJSON key}, true, false, true) vim.fn.feedkeys(termcode, 'n') end diff --git a/modules/assistant/copilot/copilot.nix b/modules/assistant/copilot/copilot.nix index 927604c..8583869 100644 --- a/modules/assistant/copilot/copilot.nix +++ b/modules/assistant/copilot/copilot.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkEnableOption mkOption types; + cfg = config.vim.assistant.copilot; in { options.vim.assistant.copilot = { diff --git a/modules/assistant/tabnine/config.nix b/modules/assistant/tabnine/config.nix index b959495..e9cc209 100644 --- a/modules/assistant/tabnine/config.nix +++ b/modules/assistant/tabnine/config.nix @@ -2,9 +2,10 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) toJSON; + inherit (lib) mkIf mkMerge mkExprBinding boolToString nvim; + cfg = config.vim.assistant.tabnine; in { config = mkIf cfg.enable { @@ -17,7 +18,7 @@ in { local completion = require("tabnine.completion") if not state.completions_cache then - return "${builtins.toJSON cfg.mappings.accept}" + return "${toJSON cfg.mappings.accept}" end vim.schedule(completion.accept) @@ -29,7 +30,7 @@ in { local completion = require("tabnine.completion") if not state.completions_cache then - return "${builtins.toJSON cfg.mappings.dismiss}" + return "${toJSON cfg.mappings.dismiss}" end vim.schedule(function() diff --git a/modules/assistant/tabnine/tabnine.nix b/modules/assistant/tabnine/tabnine.nix index 0682f79..949a6b1 100644 --- a/modules/assistant/tabnine/tabnine.nix +++ b/modules/assistant/tabnine/tabnine.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption mkOption types mkMappingOption; +in { options.vim.assistant.tabnine = { enable = mkEnableOption "Tabnine assistant"; diff --git a/modules/autopairs/nvim-autopairs/config.nix b/modules/autopairs/nvim-autopairs/config.nix index 59ad538..0aceca5 100644 --- a/modules/autopairs/nvim-autopairs/config.nix +++ b/modules/autopairs/nvim-autopairs/config.nix @@ -2,9 +2,9 @@ lib, config, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim optionalString boolToString; + cfg = config.vim.autopairs; in { config = diff --git a/modules/autopairs/nvim-autopairs/nvim-autopairs.nix b/modules/autopairs/nvim-autopairs/nvim-autopairs.nix index d64b5cb..330d118 100644 --- a/modules/autopairs/nvim-autopairs/nvim-autopairs.nix +++ b/modules/autopairs/nvim-autopairs/nvim-autopairs.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim = { autopairs = { enable = mkEnableOption "autopairs" // {default = false;}; diff --git a/modules/basic/config.nix b/modules/basic/config.nix index 82d8648..270f8ae 100644 --- a/modules/basic/config.nix +++ b/modules/basic/config.nix @@ -2,9 +2,10 @@ lib, config, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) concatStringsSep; + inherit (lib) optionalString mkIf nvim; + cfg = config.vim; in { config = { @@ -57,8 +58,8 @@ in { }; vim.configRC.basic = nvim.dag.entryAfter ["globalsScript"] '' - " Debug mode settings ${optionalString cfg.debugMode.enable '' + " Debug mode settings set verbose=${toString cfg.debugMode.level} set verbosefile=${cfg.debugMode.logFile} ''} @@ -141,7 +142,7 @@ in { ''} ${optionalString cfg.spellChecking.enable '' set spell - set spelllang=${builtins.concatStringsSep "," cfg.spellChecking.languages}${optionalString cfg.spellChecking.enableProgrammingWordList ",programming"} + set spelllang=${concatStringsSep "," cfg.spellChecking.languages}${optionalString cfg.spellChecking.enableProgrammingWordList ",programming"} ''} ${optionalString (cfg.leaderKey != null) '' let mapleader = "${toString cfg.leaderKey}" diff --git a/modules/basic/module.nix b/modules/basic/module.nix index 8bee1a6..cf972c0 100644 --- a/modules/basic/module.nix +++ b/modules/basic/module.nix @@ -2,9 +2,10 @@ pkgs, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption mkOption; + inherit (lib.types) types; +in { options.vim = { package = mkOption { type = types.package; diff --git a/modules/comments/comment-nvim/comment-nvim.nix b/modules/comments/comment-nvim/comment-nvim.nix index 29646ac..13ca475 100644 --- a/modules/comments/comment-nvim/comment-nvim.nix +++ b/modules/comments/comment-nvim/comment-nvim.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption mkMappingOption; +in { options.vim.comments.comment-nvim = { enable = mkEnableOption "smart and powerful comment plugin for neovim comment-nvim"; diff --git a/modules/comments/comment-nvim/config.nix b/modules/comments/comment-nvim/config.nix index bc29111..ea2f1e1 100644 --- a/modules/comments/comment-nvim/config.nix +++ b/modules/comments/comment-nvim/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf mkMerge mkExprBinding mkBinding nvim; + cfg = config.vim.comments.comment-nvim; self = import ./comment-nvim.nix { inherit lib; diff --git a/modules/completion/nvim-cmp/config.nix b/modules/completion/nvim-cmp/config.nix index e7ab3ac..b20f71b 100644 --- a/modules/completion/nvim-cmp/config.nix +++ b/modules/completion/nvim-cmp/config.nix @@ -2,9 +2,11 @@ lib, config, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) toJSON; + inherit (lib) addDescriptionsToMappings concatMapStringsSep attrNames concatStringsSep mapAttrsToList mkIf mkSetLuaBinding mkMerge optionalString; + inherit (lib.nvim) dag; + cfg = config.vim.autocomplete; lspkindEnabled = config.vim.lsp.enable && config.vim.lsp.lspkind.enable; @@ -31,8 +33,8 @@ with builtins; let dagPlacement = if lspkindEnabled - then nvim.dag.entryAfter ["lspkind"] - else nvim.dag.entryAnywhere; + then dag.entryAfter ["lspkind"] + else dag.entryAnywhere; in { config = mkIf cfg.enable { vim.startPlugins = [ @@ -59,7 +61,7 @@ in { (mkSetLuaBinding mappings.confirm '' function() if not require('cmp').confirm({ select = true }) then - local termcode = vim.api.nvim_replace_termcodes(${builtins.toJSON mappings.confirm.value}, true, false, true) + local termcode = vim.api.nvim_replace_termcodes(${toJSON mappings.confirm.value}, true, false, true) vim.fn.feedkeys(termcode, 'n') end @@ -85,7 +87,7 @@ in { elseif has_words_before() then cmp.complete() else - local termcode = vim.api.nvim_replace_termcodes(${builtins.toJSON mappings.next.value}, true, false, true) + local termcode = vim.api.nvim_replace_termcodes(${toJSON mappings.next.value}, true, false, true) vim.fn.feedkeys(termcode, 'n') end @@ -152,7 +154,7 @@ in { elseif has_words_before() then cmp.complete() else - local termcode = vim.api.nvim_replace_termcodes(${builtins.toJSON mappings.next.value}, true, false, true) + local termcode = vim.api.nvim_replace_termcodes(${toJSON mappings.next.value}, true, false, true) vim.fn.feedkeys(termcode, 'n') end diff --git a/modules/completion/nvim-cmp/nvim-cmp.nix b/modules/completion/nvim-cmp/nvim-cmp.nix index fb9be86..38c8619 100644 --- a/modules/completion/nvim-cmp/nvim-cmp.nix +++ b/modules/completion/nvim-cmp/nvim-cmp.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption mkMappingOption mkOption types; +in { options.vim = { autocomplete = { enable = mkEnableOption "enable autocomplete" // {default = false;}; diff --git a/modules/core/default.nix b/modules/core/default.nix index 2a35262..e4703b6 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -2,9 +2,13 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) attrValues attrNames map mapAttrs toJSON isString concatStringsSep filter; + inherit (lib) mkOption types mapAttrsFlatten filterAttrs optionalString getAttrs literalExpression; + inherit (lib) nvim; + inherit (nvim.lua) toLuaObject; + inherit (nvim.vim) valToVim; + cfg = config.vim; wrapLuaConfig = luaConfig: '' @@ -20,7 +24,7 @@ with builtins; let mkOption { type = types.bool; default = value; - description = description; + inherit description; }; # Most of the keybindings code is highly inspired by pta2002/nixvim. Thank you! @@ -67,7 +71,7 @@ with builtins; let normalizeAction = action: let # Extract the values of the config options that have been explicitly set by the user config = - filterAttrs (n: v: v != null) + filterAttrs (_: v: v != null) (getAttrs (attrNames mapConfigOptions) action); in { config = @@ -80,13 +84,13 @@ with builtins; let else action.action; }; in - builtins.attrValues (builtins.mapAttrs + attrValues (mapAttrs (key: action: let normalizedAction = normalizeAction action; in { inherit (normalizedAction) action config; - key = key; - mode = mode; + inherit key; + inherit mode; }) maps); @@ -117,171 +121,144 @@ with builtins; let default = {}; }; in { - options.vim = { - viAlias = mkOption { - description = "Enable vi alias"; - type = types.bool; - default = true; - }; - - vimAlias = mkOption { - description = "Enable vim alias"; - type = types.bool; - default = true; - }; - - configRC = mkOption { - description = "vimrc contents"; - type = types.oneOf [(nvim.types.dagOf types.lines) types.str]; - default = {}; - }; - - luaConfigRC = mkOption { - description = "vim lua config"; - type = types.oneOf [(nvim.types.dagOf types.lines) types.str]; - default = {}; - }; - - builtConfigRC = mkOption { + options = { + assertions = lib.mkOption { + type = with types; listOf unspecified; internal = true; - type = types.lines; - description = "The built config for neovim after resolving the DAG"; - }; - - startPlugins = nvim.types.pluginsOpt { default = []; - description = "List of plugins to startup."; - }; - - optPlugins = nvim.types.pluginsOpt { - default = []; - description = "List of plugins to optionally load"; - }; - - extraPlugins = mkOption { - type = types.attrsOf nvim.types.extraPluginType; - default = {}; - description = '' - List of plugins and related config. - Note that these are setup after builtin plugins. - ''; example = literalExpression '' - with pkgs.vimPlugins; { - aerial = { - package = aerial-nvim; - setup = "require('aerial').setup {}"; - }; - harpoon = { - package = harpoon; - setup = "require('harpoon').setup {}"; - after = ["aerial"]; - }; - }''; + [ + { + assertion = false; + message = "you can't enable this for that reason"; + } + ] + ''; }; - globals = mkOption { - default = {}; - description = "Set containing global variable values"; - type = types.attrs; + warnings = mkOption { + internal = true; + default = []; + type = with types; listOf str; + example = ["The `foo' service is deprecated and will go away soon!"]; + description = lib.mdDoc '' + This option allows modules to show warnings to users during + the evaluation of the system configuration. + ''; }; - maps = mkOption { - type = types.submodule { - options = { - normal = mapOptions "normal"; - insert = mapOptions "insert"; - select = mapOptions "select"; - visual = mapOptions "visual and select"; - terminal = mapOptions "terminal"; - normalVisualOp = mapOptions "normal, visual, select and operator-pending (same as plain 'map')"; - - visualOnly = mapOptions "visual only"; - operator = mapOptions "operator-pending"; - insertCommand = mapOptions "insert and command-line"; - lang = mapOptions "insert, command-line and lang-arg"; - command = mapOptions "command-line"; - }; + vim = { + viAlias = mkOption { + description = "Enable vi alias"; + type = types.bool; + default = true; }; - default = {}; - description = '' - Custom keybindings for any mode. - For plain maps (e.g. just 'map' or 'remap') use maps.normalVisualOp. - ''; + vimAlias = mkOption { + description = "Enable vim alias"; + type = types.bool; + default = true; + }; - example = '' - maps = { - normal."m" = { - silent = true; - action = "make"; - }; # Same as nnoremap m make + configRC = mkOption { + description = "vimrc contents"; + type = types.oneOf [(nvim.types.dagOf types.lines) types.str]; + default = {}; + }; + + luaConfigRC = mkOption { + description = "vim lua config"; + type = types.oneOf [(nvim.types.dagOf types.lines) types.str]; + default = {}; + }; + + builtConfigRC = mkOption { + internal = true; + type = types.lines; + description = "The built config for neovim after resolving the DAG"; + }; + + startPlugins = nvim.types.pluginsOpt { + default = []; + description = "List of plugins to startup."; + }; + + optPlugins = nvim.types.pluginsOpt { + default = []; + description = "List of plugins to optionally load"; + }; + + extraPlugins = mkOption { + type = types.attrsOf nvim.types.extraPluginType; + default = {}; + description = '' + List of plugins and related config. + Note that these are setup after builtin plugins. + ''; + example = literalExpression '' + with pkgs.vimPlugins; { + aerial = { + package = aerial-nvim; + setup = "require('aerial').setup {}"; + }; + harpoon = { + package = harpoon; + setup = "require('harpoon').setup {}"; + after = ["aerial"]; + }; + }''; + }; + + globals = mkOption { + default = {}; + description = "Set containing global variable values"; + type = types.attrs; + }; + + maps = mkOption { + type = types.submodule { + options = { + normal = mapOptions "normal"; + insert = mapOptions "insert"; + select = mapOptions "select"; + visual = mapOptions "visual and select"; + terminal = mapOptions "terminal"; + normalVisualOp = mapOptions "normal, visual, select and operator-pending (same as plain 'map')"; + + visualOnly = mapOptions "visual only"; + operator = mapOptions "operator-pending"; + insertCommand = mapOptions "insert and command-line"; + lang = mapOptions "insert, command-line and lang-arg"; + command = mapOptions "command-line"; + }; }; - ''; + default = {}; + description = '' + Custom keybindings for any mode. + + For plain maps (e.g. just 'map' or 'remap') use maps.normalVisualOp. + ''; + + example = '' + maps = { + normal."m" = { + silent = true; + action = "make"; + }; # Same as nnoremap m make + }; + ''; + }; }; }; config = let - mkVimBool = val: - if val - then "1" - else "0"; - valToVim = val: - if (isInt val) - then (builtins.toString val) - else - ( - if (isBool val) - then (mkVimBool val) - else (toJSON val) - ); - filterNonNull = mappings: filterAttrs (_name: value: value != null) mappings; globalsScript = mapAttrsFlatten (name: value: "let g:${name}=${valToVim value}") (filterNonNull cfg.globals); - toLuaObject = args: - if builtins.isAttrs args - then - if hasAttr "__raw" args - then args.__raw - else if hasAttr "__empty" args - then "{ }" - else - "{" - + (concatStringsSep "," - (mapAttrsToList - (n: v: - if head (stringToCharacters n) == "@" - then toLuaObject v - else "[${toLuaObject n}] = " + (toLuaObject v)) - (filterAttrs - ( - n: v: - !isNull v && (toLuaObject v != "{}") - ) - args))) - + "}" - else if builtins.isList args - then "{" + concatMapStringsSep "," toLuaObject args + "}" - else if builtins.isString args - then - # This should be enough! - builtins.toJSON args - else if builtins.isPath args - then builtins.toJSON (toString args) - else if builtins.isBool args - then "${boolToString args}" - else if builtins.isFloat args - then "${toString args}" - else if builtins.isInt args - then "${toString args}" - else if isNull args - then "nil" - else ""; - toLuaBindings = mode: maps: - builtins.map (value: '' + map (value: '' vim.keymap.set(${toLuaObject mode}, ${toLuaObject value.key}, ${toLuaObject value.action}, ${toLuaObject value.config}) '') (genMaps mode maps); @@ -304,8 +281,8 @@ in { mapResult, }: let # When the value is a string, default it to dag.entryAnywhere - finalDag = lib.mapAttrs (name: value: - if builtins.isString value + finalDag = lib.mapAttrs (_: value: + if isString value then nvim.dag.entryAnywhere value else value) dag; @@ -313,7 +290,7 @@ in { result = if sortedDag ? result then mapResult sortedDag.result - else abort ("Dependency cycle in ${name}: " + toJSON sortedConfig); + else abort ("Dependency cycle in ${name}: " + toJSON sortedDag); in result; in { @@ -378,6 +355,13 @@ in { }; builtConfigRC = let + failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions); + + baseSystemAssertWarn = + if failedAssertions != [] + then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}" + else lib.showWarnings config.warnings; + mkSection = r: '' " SECTION: ${r.name} ${r.data} @@ -389,7 +373,7 @@ in { inherit mapResult; }; in - vimConfig; + baseSystemAssertWarn vimConfig; }; }; } diff --git a/modules/dashboard/alpha/alpha.nix b/modules/dashboard/alpha/alpha.nix index 48b8bfa..3c43e15 100644 --- a/modules/dashboard/alpha/alpha.nix +++ b/modules/dashboard/alpha/alpha.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption; +in { options.vim.dashboard.alpha = { enable = mkEnableOption "dashboard via alpha.nvim"; }; diff --git a/modules/dashboard/alpha/config.nix b/modules/dashboard/alpha/config.nix index a0df3be..a2ee14b 100644 --- a/modules/dashboard/alpha/config.nix +++ b/modules/dashboard/alpha/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.dashboard.alpha; in { config = mkIf cfg.enable { diff --git a/modules/dashboard/dashboard-nvim/config.nix b/modules/dashboard/dashboard-nvim/config.nix index 14166f6..13c08e6 100644 --- a/modules/dashboard/dashboard-nvim/config.nix +++ b/modules/dashboard/dashboard-nvim/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.dashboard.dashboard-nvim; in { config = mkIf cfg.enable { diff --git a/modules/dashboard/dashboard-nvim/dashboard-nvim.nix b/modules/dashboard/dashboard-nvim/dashboard-nvim.nix index 6823deb..78264ca 100644 --- a/modules/dashboard/dashboard-nvim/dashboard-nvim.nix +++ b/modules/dashboard/dashboard-nvim/dashboard-nvim.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption; +in { options.vim.dashboard.dashboard-nvim = { enable = mkEnableOption "dashboard via dashboard.nvim"; }; diff --git a/modules/dashboard/startify/config.nix b/modules/dashboard/startify/config.nix index c69d774..76308ac 100644 --- a/modules/dashboard/startify/config.nix +++ b/modules/dashboard/startify/config.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with builtins; -with lib; let +}: let + inherit (lib) mkIf; + cfg = config.vim.dashboard.startify; mkVimBool = val: diff --git a/modules/dashboard/startify/startify.nix b/modules/dashboard/startify/startify.nix index de208cd..36118f4 100644 --- a/modules/dashboard/startify/startify.nix +++ b/modules/dashboard/startify/startify.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with builtins; -with lib; { +}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim.dashboard.startify = { enable = mkEnableOption "dashboard via vim-startify"; diff --git a/modules/debugger/nvim-dap/config.nix b/modules/debugger/nvim-dap/config.nix index 874e1b6..db9558d 100644 --- a/modules/debugger/nvim-dap/config.nix +++ b/modules/debugger/nvim-dap/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) addDescriptionsToMappings mkMerge mkIf mapAttrs nvim mkSetLuaBinding optionalString; + cfg = config.vim.debugger.nvim-dap; self = import ./nvim-dap.nix { inherit lib; diff --git a/modules/debugger/nvim-dap/nvim-dap.nix b/modules/debugger/nvim-dap/nvim-dap.nix index 7e43264..ade007a 100644 --- a/modules/debugger/nvim-dap/nvim-dap.nix +++ b/modules/debugger/nvim-dap/nvim-dap.nix @@ -1,5 +1,6 @@ -{lib, ...}: -with lib; { +{lib, ...}: let + inherit (lib) mkEnableOption mkOption types mkMappingOption; +in { options.vim.debugger.nvim-dap = { enable = mkEnableOption "debugging via nvim-dap"; diff --git a/modules/default.nix b/modules/default.nix index c58f17d..31cf87d 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -5,8 +5,8 @@ inputs: { check ? true, extraSpecialArgs ? {}, }: let - inherit (pkgs) neovim-unwrapped wrapNeovim vimPlugins; inherit (builtins) map filter isString toString getAttr; + inherit (pkgs) wrapNeovim vimPlugins; inherit (pkgs.vimUtils) buildVimPlugin; extendedLib = import ../lib/stdlib-extended.nix lib; @@ -21,6 +21,8 @@ inputs: { specialArgs = {modulesPath = toString ./.;} // extraSpecialArgs; }; + vimOptions = module.config.vim; + buildPlug = {pname, ...} @ args: assert lib.asserts.assertMsg (pname != "nvim-treesitter") "Use buildTreesitterPlug for building nvim-treesitter."; buildVimPlugin (args @@ -31,8 +33,6 @@ inputs: { buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars); - vimOptions = module.config.vim; - buildConfigPlugins = plugins: map (plug: ( diff --git a/modules/filetree/nvimtree/config.nix b/modules/filetree/nvimtree/config.nix index 79ae21f..5f11c5a 100644 --- a/modules/filetree/nvimtree/config.nix +++ b/modules/filetree/nvimtree/config.nix @@ -3,9 +3,9 @@ lib, pkgs, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf mkMerge mkBinding nvim boolToString; + cfg = config.vim.filetree.nvimTree; self = import ./nvimtree.nix { inherit pkgs; diff --git a/modules/filetree/nvimtree/nvimtree.nix b/modules/filetree/nvimtree/nvimtree.nix index f329328..3e68f8a 100644 --- a/modules/filetree/nvimtree/nvimtree.nix +++ b/modules/filetree/nvimtree/nvimtree.nix @@ -2,9 +2,9 @@ pkgs, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption mkOption types literalExpression; +in { options.vim.filetree.nvimTree = { enable = mkEnableOption "filetree via nvim-tree.lua"; diff --git a/modules/git/config.nix b/modules/git/config.nix index cda7279..b22b48a 100644 --- a/modules/git/config.nix +++ b/modules/git/config.nix @@ -2,9 +2,10 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) toJSON; + inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetExprBinding mkSetLuaBinding nvim; + cfg = config.vim.git; self = import ./git.nix {inherit lib;}; @@ -70,7 +71,7 @@ in { vim.lsp.null-ls.sources.gitsigns-ca = '' table.insert( ls_sources, - null_ls.builtins.code_actions.gitsigns + null_ls.gcode_actions.gitsigns ) ''; }) diff --git a/modules/git/git.nix b/modules/git/git.nix index c9d059e..0447fc4 100644 --- a/modules/git/git.nix +++ b/modules/git/git.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption mkMappingOption; +in { options.vim.git = { enable = mkEnableOption "git tools via gitsigns"; diff --git a/modules/languages/bash/bash.nix b/modules/languages/bash/bash.nix index 150ad0d..243f30c 100644 --- a/modules/languages/bash/bash.nix +++ b/modules/languages/bash/bash.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with builtins; let - inherit (lib) mkOption mkEnableOption types; +}: let + inherit (builtins) attrNames; + inherit (lib) mkOption mkEnableOption types isList nvim; cfg = config.vim.languages.bash; diff --git a/modules/languages/bash/config.nix b/modules/languages/bash/config.nix index efd0ea9..241032d 100644 --- a/modules/languages/bash/config.nix +++ b/modules/languages/bash/config.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) isList nvim mkIf mkMerge; + cfg = config.vim.languages.bash; diagnostics = { shellcheck = { diff --git a/modules/languages/clang.nix b/modules/languages/clang.nix index 3ed16d7..ee40edf 100644 --- a/modules/languages/clang.nix +++ b/modules/languages/clang.nix @@ -3,9 +3,10 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) attrNames; + inherit (lib) isList nvim optionalString mkEnableOption mkOption types mkIf mkMerge; + cfg = config.vim.languages.clang; defaultServer = "ccls"; diff --git a/modules/languages/dart/config.nix b/modules/languages/dart/config.nix index 991a384..510a413 100644 --- a/modules/languages/dart/config.nix +++ b/modules/languages/dart/config.nix @@ -3,9 +3,9 @@ lib, pkgs, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) isList nvim mkIf mkMerge optionalString boolToString; + cfg = config.vim.languages.dart; ftcfg = cfg.flutter-tools; servers = { diff --git a/modules/languages/dart/dart.nix b/modules/languages/dart/dart.nix index edccb12..c30f1f3 100644 --- a/modules/languages/dart/dart.nix +++ b/modules/languages/dart/dart.nix @@ -3,9 +3,10 @@ lib, pkgs, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) attrNames; + inherit (lib) isList nvim mkEnableOption mkOption types optionalString; + cfg = config.vim.languages.dart; defaultServer = "dart"; servers = { diff --git a/modules/languages/elixir/config.nix b/modules/languages/elixir/config.nix index e0ef5f9..dc05a48 100644 --- a/modules/languages/elixir/config.nix +++ b/modules/languages/elixir/config.nix @@ -3,9 +3,9 @@ lib, pkgs, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) nvim mkIf getExe; + cfg = config.vim.languages.elixir; in { config = mkIf (cfg.enable) { @@ -23,7 +23,7 @@ in { -- alternatively, point to an existing elixir-ls installation (optional) -- not currently supported by elixirls, but can be a table if you wish to pass other args `{"path/to/elixirls", "--foo"}` - cmd = "${lib.getExe pkgs.elixir-ls}", + cmd = "${getExe pkgs.elixir-ls}", -- default settings, use the `settings` function to override settings settings = elixirls.settings { diff --git a/modules/languages/elixir/elixir-tools.nix b/modules/languages/elixir/elixir-tools.nix index 5232acb..42e69a3 100644 --- a/modules/languages/elixir/elixir-tools.nix +++ b/modules/languages/elixir/elixir-tools.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption; +in { options.vim.languages.elixir = { enable = mkEnableOption "Elixir language support"; }; diff --git a/modules/languages/go.nix b/modules/languages/go.nix index 27717f4..8e3694c 100644 --- a/modules/languages/go.nix +++ b/modules/languages/go.nix @@ -3,9 +3,10 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) attrNames; + inherit (lib) isList nvim getExe mkEnableOption mkOption types mkMerge mkIf; + cfg = config.vim.languages.go; defaultServer = "gopls"; diff --git a/modules/languages/html.nix b/modules/languages/html.nix index b897e1c..e2eadac 100644 --- a/modules/languages/html.nix +++ b/modules/languages/html.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkEnableOption mkOption types nvim mkIf mkMerge optional; + cfg = config.vim.languages.html; in { options.vim.languages.html = { diff --git a/modules/languages/java.nix b/modules/languages/java.nix index 65daa8e..d09458f 100644 --- a/modules/languages/java.nix +++ b/modules/languages/java.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge; + cfg = config.vim.languages.java; in { options.vim.languages.java = { diff --git a/modules/languages/lua.nix b/modules/languages/lua.nix index d42d13a..e902aa9 100644 --- a/modules/languages/lua.nix +++ b/modules/languages/lua.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString getExe; + cfg = config.vim.languages.lua; in { options.vim.languages.lua = { diff --git a/modules/languages/markdown/config.nix b/modules/languages/markdown/config.nix index b031f47..ba49fb9 100644 --- a/modules/languages/markdown/config.nix +++ b/modules/languages/markdown/config.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) nvim mkIf mkMerge; + cfg = config.vim.languages.markdown; in { config = mkIf cfg.enable (mkMerge [ diff --git a/modules/languages/markdown/markdown.nix b/modules/languages/markdown/markdown.nix index 551a655..153eae5 100644 --- a/modules/languages/markdown/markdown.nix +++ b/modules/languages/markdown/markdown.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkEnableOption mkOption types nvim; + cfg = config.vim.languages.markdown; in { options.vim.languages.markdown = { diff --git a/modules/languages/nix.nix b/modules/languages/nix.nix index 8b90b28..e8b5578 100644 --- a/modules/languages/nix.nix +++ b/modules/languages/nix.nix @@ -3,9 +3,10 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) attrNames; + inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString; + cfg = config.vim.languages.nix; useFormat = "on_attach = default_on_attach"; diff --git a/modules/languages/php.nix b/modules/languages/php.nix index 63bc409..6a0071a 100644 --- a/modules/languages/php.nix +++ b/modules/languages/php.nix @@ -3,9 +3,10 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) attrNames; + inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe; + cfg = config.vim.languages.php; defaultServer = "phpactor"; diff --git a/modules/languages/python.nix b/modules/languages/python.nix index d228ff6..970906f 100644 --- a/modules/languages/python.nix +++ b/modules/languages/python.nix @@ -3,9 +3,10 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) attrNames; + inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe literalExpression; + cfg = config.vim.languages.python; defaultServer = "pyright"; diff --git a/modules/languages/rust.nix b/modules/languages/rust.nix index 3ab4433..1112f7b 100644 --- a/modules/languages/rust.nix +++ b/modules/languages/rust.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString boolToString optionals; + cfg = config.vim.languages.rust; in { options.vim.languages.rust = { diff --git a/modules/languages/sql.nix b/modules/languages/sql.nix index 2104050..83415ba 100644 --- a/modules/languages/sql.nix +++ b/modules/languages/sql.nix @@ -3,9 +3,10 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) attrNames; + inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge; + cfg = config.vim.languages.sql; sqlfluffDefault = pkgs.sqlfluff; diff --git a/modules/languages/svelte.nix b/modules/languages/svelte.nix index 20a2356..2c0d40e 100644 --- a/modules/languages/svelte.nix +++ b/modules/languages/svelte.nix @@ -3,9 +3,10 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) attrNames; + inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge; + cfg = config.vim.languages.svelte; defaultServer = "svelte"; diff --git a/modules/languages/tidal/config.nix b/modules/languages/tidal/config.nix index 7c748e5..c659d06 100644 --- a/modules/languages/tidal/config.nix +++ b/modules/languages/tidal/config.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf; + cfg = config.vim.tidal; in { config = mkIf (cfg.enable) { diff --git a/modules/languages/tidal/tidal.nix b/modules/languages/tidal/tidal.nix index 5bcd255..e5ec413 100644 --- a/modules/languages/tidal/tidal.nix +++ b/modules/languages/tidal/tidal.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim.tidal = { enable = mkEnableOption "tidalcycles tools and plugins"; diff --git a/modules/languages/ts.nix b/modules/languages/ts.nix index 58c1bc9..7fc1a24 100644 --- a/modules/languages/ts.nix +++ b/modules/languages/ts.nix @@ -3,9 +3,10 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) attrNames; + inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge; + cfg = config.vim.languages.ts; defaultServer = "tsserver"; diff --git a/modules/languages/zig.nix b/modules/languages/zig.nix index 7dbb6d6..bb4f278 100644 --- a/modules/languages/zig.nix +++ b/modules/languages/zig.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge; + cfg = config.vim.languages.zig; in { options.vim.languages.zig = { diff --git a/modules/lsp/config.nix b/modules/lsp/config.nix index eacbfa2..1d44ea7 100644 --- a/modules/lsp/config.nix +++ b/modules/lsp/config.nix @@ -3,9 +3,9 @@ lib, pkgs, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) addDescriptionsToMappings mkIf optional boolToString optionalString; + cfg = config.vim.lsp; usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp"; self = import ./module.nix {inherit config lib pkgs;}; diff --git a/modules/lsp/lightbulb/config.nix b/modules/lsp/lightbulb/config.nix index 97f5e07..3a13f68 100644 --- a/modules/lsp/lightbulb/config.nix +++ b/modules/lsp/lightbulb/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.lsp; in { config = mkIf (cfg.enable && cfg.lightbulb.enable) { diff --git a/modules/lsp/lightbulb/lightbulb.nix b/modules/lsp/lightbulb/lightbulb.nix index b754835..44d0ce0 100644 --- a/modules/lsp/lightbulb/lightbulb.nix +++ b/modules/lsp/lightbulb/lightbulb.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption; +in { options.vim.lsp = { lightbulb = { enable = mkEnableOption "Lightbulb for code actions. Requires an emoji font"; diff --git a/modules/lsp/lsp-signature/config.nix b/modules/lsp/lsp-signature/config.nix index 1e73476..18ac5d1 100644 --- a/modules/lsp/lsp-signature/config.nix +++ b/modules/lsp/lsp-signature/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim optionalString; + cfg = config.vim.lsp; in { config = mkIf (cfg.enable && cfg.lspSignature.enable) { diff --git a/modules/lsp/lsp-signature/lsp-signature.nix b/modules/lsp/lsp-signature/lsp-signature.nix index b8b0a72..d05161e 100644 --- a/modules/lsp/lsp-signature/lsp-signature.nix +++ b/modules/lsp/lsp-signature/lsp-signature.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption; +in { options.vim.lsp = { lspSignature = { enable = mkEnableOption "lsp signature viewer"; diff --git a/modules/lsp/lspconfig/config.nix b/modules/lsp/lspconfig/config.nix index e9d7b3c..527bbed 100644 --- a/modules/lsp/lspconfig/config.nix +++ b/modules/lsp/lspconfig/config.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf mkMerge nvim optionalString mapAttrs; + cfg = config.vim.lsp; in { config = mkIf cfg.lspconfig.enable (mkMerge [ diff --git a/modules/lsp/lspconfig/lspconfig.nix b/modules/lsp/lspconfig/lspconfig.nix index 7bc3dab..7dd8ff0 100644 --- a/modules/lsp/lspconfig/lspconfig.nix +++ b/modules/lsp/lspconfig/lspconfig.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim.lsp.lspconfig = { enable = mkEnableOption "nvim-lspconfig, also enabled automatically"; diff --git a/modules/lsp/lspkind/config.nix b/modules/lsp/lspkind/config.nix index a243d62..2c21c26 100644 --- a/modules/lsp/lspkind/config.nix +++ b/modules/lsp/lspkind/config.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.lsp; in { config = mkIf (cfg.enable && cfg.lspkind.enable) { diff --git a/modules/lsp/lspkind/lspkind.nix b/modules/lsp/lspkind/lspkind.nix index 82d721b..4856688 100644 --- a/modules/lsp/lspkind/lspkind.nix +++ b/modules/lsp/lspkind/lspkind.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkEnableOption mkOption types; + cfg = config.vim.lsp; in { options.vim.lsp = { diff --git a/modules/lsp/lsplines/config.nix b/modules/lsp/lsplines/config.nix index 8fe46d3..66eb5ff 100644 --- a/modules/lsp/lsplines/config.nix +++ b/modules/lsp/lsplines/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.lsp; in { config = mkIf (cfg.enable && cfg.lsplines.enable) { diff --git a/modules/lsp/lsplines/lsplines.nix b/modules/lsp/lsplines/lsplines.nix index 2b3eec4..9b5f6a6 100644 --- a/modules/lsp/lsplines/lsplines.nix +++ b/modules/lsp/lsplines/lsplines.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption; +in { options.vim.lsp = { lsplines = { enable = mkEnableOption "diagnostics using virtual lines on top of the real line of code. [lsp_lines]"; diff --git a/modules/lsp/lspsaga/config.nix b/modules/lsp/lspsaga/config.nix index 74b91fc..722bdde 100644 --- a/modules/lsp/lspsaga/config.nix +++ b/modules/lsp/lspsaga/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) addDescriptionsToMappings mkIf mkSetLuaBinding mkMerge nvim optionalString; + cfg = config.vim.lsp; self = import ./lspsaga.nix {inherit lib;}; diff --git a/modules/lsp/lspsaga/lspsaga.nix b/modules/lsp/lspsaga/lspsaga.nix index b3459f3..35e1ecc 100644 --- a/modules/lsp/lspsaga/lspsaga.nix +++ b/modules/lsp/lspsaga/lspsaga.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption mkMappingOption; +in { options.vim.lsp.lspsaga = { enable = mkEnableOption "LSP Saga"; diff --git a/modules/lsp/module.nix b/modules/lsp/module.nix index 38d73b1..1a56240 100644 --- a/modules/lsp/module.nix +++ b/modules/lsp/module.nix @@ -1,6 +1,5 @@ -{lib, ...}: -with lib; -with builtins; let +{lib, ...}: let + inherit (lib) mkEnableOption mkMappingOption; in { options.vim.lsp = { enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options"; diff --git a/modules/lsp/null-ls/config.nix b/modules/lsp/null-ls/config.nix index bc5aee7..23a6818 100644 --- a/modules/lsp/null-ls/config.nix +++ b/modules/lsp/null-ls/config.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf mkMerge nvim mapAttrs; + cfg = config.vim.lsp; in { config = mkIf cfg.null-ls.enable (mkMerge [ diff --git a/modules/lsp/null-ls/null-ls.nix b/modules/lsp/null-ls/null-ls.nix index b8b661c..3ffb0ca 100644 --- a/modules/lsp/null-ls/null-ls.nix +++ b/modules/lsp/null-ls/null-ls.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkEnableOption mkOption types; + cfg = config.vim.lsp; in { options.vim.lsp.null-ls = { diff --git a/modules/lsp/nvim-code-action-menu/config.nix b/modules/lsp/nvim-code-action-menu/config.nix index 8fd54e5..c64f027 100644 --- a/modules/lsp/nvim-code-action-menu/config.nix +++ b/modules/lsp/nvim-code-action-menu/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) addDescriptionsToMappings mkIf mkSetBinding nvim; + cfg = config.vim.lsp; self = import ./nvim-code-action-menu.nix {inherit lib;}; diff --git a/modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix b/modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix index deb5166..c04beda 100644 --- a/modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix +++ b/modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix @@ -1,5 +1,6 @@ -{lib, ...}: -with lib; { +{lib, ...}: let + inherit (lib) mkEnableOption mkMappingOption; +in { options.vim.lsp = { nvimCodeActionMenu = { enable = mkEnableOption "nvim code action menu"; diff --git a/modules/lsp/trouble/config.nix b/modules/lsp/trouble/config.nix index 0f3aa11..ee136a5 100644 --- a/modules/lsp/trouble/config.nix +++ b/modules/lsp/trouble/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetBinding nvim; + cfg = config.vim.lsp; self = import ./trouble.nix {inherit lib;}; diff --git a/modules/lsp/trouble/trouble.nix b/modules/lsp/trouble/trouble.nix index 4423fdf..b8aa0de 100644 --- a/modules/lsp/trouble/trouble.nix +++ b/modules/lsp/trouble/trouble.nix @@ -1,5 +1,6 @@ -{lib, ...}: -with lib; { +{lib, ...}: let + inherit (lib) mkEnableOption mkMappingOption; +in { options.vim.lsp = { trouble = { enable = mkEnableOption "trouble diagnostics viewer"; diff --git a/modules/minimap/codewindow/codewindow.nix b/modules/minimap/codewindow/codewindow.nix index d67762b..551dd8e 100644 --- a/modules/minimap/codewindow/codewindow.nix +++ b/modules/minimap/codewindow/codewindow.nix @@ -1,5 +1,6 @@ -{lib, ...}: -with lib; { +{lib, ...}: let + inherit (lib) mkEnableOption mkMappingOption; +in { options.vim.minimap.codewindow = { enable = mkEnableOption "codewindow plugin for minimap view"; diff --git a/modules/minimap/codewindow/config.nix b/modules/minimap/codewindow/config.nix index ac82829..86b0137 100644 --- a/modules/minimap/codewindow/config.nix +++ b/modules/minimap/codewindow/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetLuaBinding nvim; + cfg = config.vim.minimap.codewindow; self = import ./codewindow.nix {inherit lib;}; diff --git a/modules/minimap/minimap-vim/config.nix b/modules/minimap/minimap-vim/config.nix index 15f1761..ef318f7 100644 --- a/modules/minimap/minimap-vim/config.nix +++ b/modules/minimap/minimap-vim/config.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf; + cfg = config.vim.minimap.minimap-vim; in { config = mkIf cfg.enable { diff --git a/modules/minimap/minimap-vim/minimap-vim.nix b/modules/minimap/minimap-vim/minimap-vim.nix index bd237aa..12f7f42 100644 --- a/modules/minimap/minimap-vim/minimap-vim.nix +++ b/modules/minimap/minimap-vim/minimap-vim.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption; +in { options.vim.minimap.minimap-vim = { enable = mkEnableOption "minimap-vim plugin for minimap view"; }; diff --git a/modules/modules.nix b/modules/modules.nix index b3cb152..1bfc069 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -34,10 +34,14 @@ pkgsModule = {config, ...}: { config = { - _module.args.baseModules = modules; - _module.args.pkgsPath = lib.mkDefault pkgs.path; - _module.args.pkgs = lib.mkDefault pkgs; - _module.check = check; + _module = { + inherit check; + args = { + baseModules = modules; + pkgsPath = lib.mkDefault pkgs.path; + pkgs = lib.mkDefault pkgs; + }; + }; }; }; in diff --git a/modules/notes/mind-nvim/config.nix b/modules/notes/mind-nvim/config.nix index 5e23f06..98f7751 100644 --- a/modules/notes/mind-nvim/config.nix +++ b/modules/notes/mind-nvim/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.notes.mind-nvim; in { config = mkIf (cfg.enable) { diff --git a/modules/notes/mind-nvim/mind-nvim.nix b/modules/notes/mind-nvim/mind-nvim.nix index d9b069c..f0d43ea 100644 --- a/modules/notes/mind-nvim/mind-nvim.nix +++ b/modules/notes/mind-nvim/mind-nvim.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption; +in { options.vim.notes.mind-nvim = { enable = mkEnableOption "organizer tool for Neovim."; }; diff --git a/modules/notes/obsidian/config.nix b/modules/notes/obsidian/config.nix index 8f9c2d1..192244b 100644 --- a/modules/notes/obsidian/config.nix +++ b/modules/notes/obsidian/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.notes.obsidian; auto = config.vim.autocomplete; in { diff --git a/modules/notes/obsidian/obsidian.nix b/modules/notes/obsidian/obsidian.nix index 60ee71f..cfc0eda 100644 --- a/modules/notes/obsidian/obsidian.nix +++ b/modules/notes/obsidian/obsidian.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim.notes = { obsidian = { enable = mkEnableOption "complementary neovim plugins for Obsidian editor"; diff --git a/modules/notes/orgmode/config.nix b/modules/notes/orgmode/config.nix index 1dadb50..967a937 100644 --- a/modules/notes/orgmode/config.nix +++ b/modules/notes/orgmode/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf mkMerge nvim; + cfg = config.vim.notes.orgmode; in { config = mkIf cfg.enable (mkMerge [ diff --git a/modules/notes/orgmode/orgmode.nix b/modules/notes/orgmode/orgmode.nix index f31333d..d7fce12 100644 --- a/modules/notes/orgmode/orgmode.nix +++ b/modules/notes/orgmode/orgmode.nix @@ -3,9 +3,9 @@ lib, pkgs, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption types mkOption nvim; +in { options.vim.notes.orgmode = { enable = mkEnableOption "nvim-orgmode: Neovim plugin for Emac Orgmode. Get the best of both worlds"; diff --git a/modules/notes/todo-comments/config.nix b/modules/notes/todo-comments/config.nix index 3adb0f6..f1ced60 100644 --- a/modules/notes/todo-comments/config.nix +++ b/modules/notes/todo-comments/config.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkMerge mkBinding mkIf; + cfg = config.vim.notes.todo-comments; self = import ./todo-comments.nix {inherit lib;}; mappings = self.options.vim.notes.todo-comments.mappings; diff --git a/modules/notes/todo-comments/todo-comments.nix b/modules/notes/todo-comments/todo-comments.nix index 992a6c6..6fbc71b 100644 --- a/modules/notes/todo-comments/todo-comments.nix +++ b/modules/notes/todo-comments/todo-comments.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption mkOption types mkMappingOption; +in { options.vim.notes.todo-comments = { enable = mkEnableOption "todo-comments: highlight and search for todo comments like TODO, HACK, BUG in your code base"; diff --git a/modules/projects/project-nvim/config.nix b/modules/projects/project-nvim/config.nix index d78e10f..6fc78e4 100644 --- a/modules/projects/project-nvim/config.nix +++ b/modules/projects/project-nvim/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim boolToString concatStringsSep; + cfg = config.vim.projects.project-nvim; in { config = mkIf cfg.enable { diff --git a/modules/projects/project-nvim/project-nvim.nix b/modules/projects/project-nvim/project-nvim.nix index 1e3fb8b..5811f96 100644 --- a/modules/projects/project-nvim/project-nvim.nix +++ b/modules/projects/project-nvim/project-nvim.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim.projects.project-nvim = { enable = mkEnableOption "project-nvim for project management"; diff --git a/modules/rich-presence/presence-nvim/config.nix b/modules/rich-presence/presence-nvim/config.nix index 493853c..452af4f 100644 --- a/modules/rich-presence/presence-nvim/config.nix +++ b/modules/rich-presence/presence-nvim/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim boolToString; + cfg = config.vim.presence.presence-nvim; in { config = mkIf cfg.enable { diff --git a/modules/rich-presence/presence-nvim/presence-nvim.nix b/modules/rich-presence/presence-nvim/presence-nvim.nix index b7acf48..911ff2b 100644 --- a/modules/rich-presence/presence-nvim/presence-nvim.nix +++ b/modules/rich-presence/presence-nvim/presence-nvim.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim.presence.presence-nvim = { enable = mkEnableOption "presence.nvim plugin for discord rich presence"; diff --git a/modules/session/nvim-session-manager/config.nix b/modules/session/nvim-session-manager/config.nix index a65b21f..70ed26b 100644 --- a/modules/session/nvim-session-manager/config.nix +++ b/modules/session/nvim-session-manager/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf optionals mkMerge mkBinding nvim concatStringsSep boolToString; + cfg = config.vim.session.nvim-session-manager; in { config = mkIf cfg.enable { diff --git a/modules/session/nvim-session-manager/nvim-session-manager.nix b/modules/session/nvim-session-manager/nvim-session-manager.nix index 881a6ae..a5395a0 100644 --- a/modules/session/nvim-session-manager/nvim-session-manager.nix +++ b/modules/session/nvim-session-manager/nvim-session-manager.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim.session.nvim-session-manager = { enable = mkEnableOption "nvim-session-manager: manage sessions like folders in VSCode"; diff --git a/modules/snippets/vsnip/config.nix b/modules/snippets/vsnip/config.nix index bf76d55..fd4bf50 100644 --- a/modules/snippets/vsnip/config.nix +++ b/modules/snippets/vsnip/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf; + cfg = config.vim.snippets.vsnip; in { config = mkIf cfg.enable { diff --git a/modules/snippets/vsnip/vsnip.nix b/modules/snippets/vsnip/vsnip.nix index c59a5d6..2d423cb 100644 --- a/modules/snippets/vsnip/vsnip.nix +++ b/modules/snippets/vsnip/vsnip.nix @@ -1,5 +1,6 @@ -{lib, ...}: -with lib; { +{lib, ...}: let + inherit (lib) mkEnableOption; +in { options.vim.snippets.vsnip = { enable = mkEnableOption "vim-vsnip: snippet LSP/VSCode's format"; }; diff --git a/modules/statusline/lualine/config.nix b/modules/statusline/lualine/config.nix index 53cf3fd..bf33e13 100644 --- a/modules/statusline/lualine/config.nix +++ b/modules/statusline/lualine/config.nix @@ -2,10 +2,9 @@ config, lib, ... -}: -with lib; let +}: let cfg = config.vim.statusline.lualine; - inherit (nvim.lua) luaTable; + inherit (lib) mkIf nvim boolToString optionalString; in { config = (mkIf cfg.enable) { vim.startPlugins = [ @@ -33,21 +32,21 @@ in { }, -- active sections sections = { - lualine_a = ${luaTable (cfg.activeSection.a ++ cfg.extraActiveSection.a)}, - lualine_b = ${luaTable (cfg.activeSection.b ++ cfg.extraActiveSection.b)}, - lualine_c = ${luaTable (cfg.activeSection.c ++ cfg.extraActiveSection.c)}, - lualine_x = ${luaTable (cfg.activeSection.x ++ cfg.extraActiveSection.x)}, - lualine_y = ${luaTable (cfg.activeSection.y ++ cfg.extraActiveSection.y)}, - lualine_z = ${luaTable (cfg.activeSection.z ++ cfg.extraActiveSection.z)}, + lualine_a = ${nvim.lua.luaTable (cfg.activeSection.a ++ cfg.extraActiveSection.a)}, + lualine_b = ${nvim.lua.luaTable (cfg.activeSection.b ++ cfg.extraActiveSection.b)}, + lualine_c = ${nvim.lua.luaTable (cfg.activeSection.c ++ cfg.extraActiveSection.c)}, + lualine_x = ${nvim.lua.luaTable (cfg.activeSection.x ++ cfg.extraActiveSection.x)}, + lualine_y = ${nvim.lua.luaTable (cfg.activeSection.y ++ cfg.extraActiveSection.y)}, + lualine_z = ${nvim.lua.luaTable (cfg.activeSection.z ++ cfg.extraActiveSection.z)}, }, -- inactive_sections = { - lualine_a = ${luaTable (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a)}, - lualine_b = ${luaTable (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b)}, - lualine_c = ${luaTable (cfg.inactiveSection.c ++ cfg.extraInactiveSection.c)}, - lualine_x = ${luaTable (cfg.inactiveSection.x ++ cfg.extraInactiveSection.x)}, - lualine_y = ${luaTable (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y)}, - lualine_z = ${luaTable (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z)}, + lualine_a = ${nvim.lua.luaTable (cfg.inactiveSection.a ++ cfg.extraInactiveSection.a)}, + lualine_b = ${nvim.lua.luaTable (cfg.inactiveSection.b ++ cfg.extraInactiveSection.b)}, + lualine_c = ${nvim.lua.luaTable (cfg.inactiveSection.c ++ cfg.extraInactiveSection.c)}, + lualine_x = ${nvim.lua.luaTable (cfg.inactiveSection.x ++ cfg.extraInactiveSection.x)}, + lualine_y = ${nvim.lua.luaTable (cfg.inactiveSection.y ++ cfg.extraInactiveSection.y)}, + lualine_z = ${nvim.lua.luaTable (cfg.inactiveSection.z ++ cfg.extraInactiveSection.z)}, }, tabline = {}, diff --git a/modules/statusline/lualine/lualine.nix b/modules/statusline/lualine/lualine.nix index c953fe2..f3c4306 100644 --- a/modules/statusline/lualine/lualine.nix +++ b/modules/statusline/lualine/lualine.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkEnableOption mkOption types elem optional; + supported_themes = import ./supported_themes.nix; colorPuccin = if config.vim.statusline.lualine.theme == "catppuccin" diff --git a/modules/tabline/nvim-bufferline/config.nix b/modules/tabline/nvim-bufferline/config.nix index 05c6399..9004c89 100644 --- a/modules/tabline/nvim-bufferline/config.nix +++ b/modules/tabline/nvim-bufferline/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf mkMerge mkLuaBinding mkBinding nvim; + cfg = config.vim.tabline.nvimBufferline; self = import ./nvim-bufferline.nix { inherit lib; diff --git a/modules/tabline/nvim-bufferline/nvim-bufferline.nix b/modules/tabline/nvim-bufferline/nvim-bufferline.nix index ec2478e..1ca3ff0 100644 --- a/modules/tabline/nvim-bufferline/nvim-bufferline.nix +++ b/modules/tabline/nvim-bufferline/nvim-bufferline.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption mkMappingOption; +in { options.vim.tabline.nvimBufferline = { enable = mkEnableOption "nvim-bufferline-lua as a bufferline"; diff --git a/modules/terminal/toggleterm/config.nix b/modules/terminal/toggleterm/config.nix index 9caf691..eca6e60 100644 --- a/modules/terminal/toggleterm/config.nix +++ b/modules/terminal/toggleterm/config.nix @@ -2,9 +2,10 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (builtins) toJSON; + inherit (lib) mkMerge mkIf mkBinding nvim getExe; + cfg = config.vim.terminal.toggleterm; in { config = mkMerge [ diff --git a/modules/terminal/toggleterm/toggleterm.nix b/modules/terminal/toggleterm/toggleterm.nix index 9acadd4..3579063 100644 --- a/modules/terminal/toggleterm/toggleterm.nix +++ b/modules/terminal/toggleterm/toggleterm.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption mkOption types mkMappingOption; +in { options.vim.terminal.toggleterm = { enable = mkEnableOption "toggleterm as a replacement to built-in terminal command"; mappings = { diff --git a/modules/theme/config.nix b/modules/theme/config.nix index 450821a..01be14c 100644 --- a/modules/theme/config.nix +++ b/modules/theme/config.nix @@ -2,8 +2,9 @@ config, lib, ... -}: -with lib; { +}: let + inherit (lib) mkDefault; +in { config = { vim.theme = { enable = mkDefault false; diff --git a/modules/theme/theme.nix b/modules/theme/theme.nix index 6dcb66d..094a56c 100644 --- a/modules/theme/theme.nix +++ b/modules/theme/theme.nix @@ -2,10 +2,9 @@ config, lib, ... -}: -with lib; -with lib.attrsets; -with builtins; let +}: let + inherit (lib) mkOption types attrNames mkIf nvim; + cfg = config.vim.theme; supported_themes = import ./supported_themes.nix {inherit lib;}; in { diff --git a/modules/treesitter/config.nix b/modules/treesitter/config.nix index 0bb3a0b..d197129 100644 --- a/modules/treesitter/config.nix +++ b/modules/treesitter/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) addDescriptionsToMappings mkIf optional mkSetBinding mkMerge nvim; + cfg = config.vim.treesitter; usingNvimCmp = config.vim.autocomplete.enable && config.vim.autocomplete.type == "nvim-cmp"; diff --git a/modules/treesitter/context.nix b/modules/treesitter/context.nix index bcc7ce9..d6859d4 100644 --- a/modules/treesitter/context.nix +++ b/modules/treesitter/context.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkEnableOption mkOption types mkIf nvim boolToString; + treesitter = config.vim.treesitter; cfg = treesitter.context; in { diff --git a/modules/treesitter/treesitter.nix b/modules/treesitter/treesitter.nix index e4e9f64..413f303 100644 --- a/modules/treesitter/treesitter.nix +++ b/modules/treesitter/treesitter.nix @@ -1,5 +1,6 @@ -{lib, ...}: -with lib; { +{lib, ...}: let + inherit (lib) mkEnableOption mkMappingOption mkOption types; +in { options.vim.treesitter = { enable = mkEnableOption "treesitter, also enabled automatically through language options"; diff --git a/modules/ui/breadcrumbs/config.nix b/modules/ui/breadcrumbs/config.nix index 0d988ca..22de56d 100644 --- a/modules/ui/breadcrumbs/config.nix +++ b/modules/ui/breadcrumbs/config.nix @@ -2,8 +2,7 @@ config, lib, ... -}: -with builtins; let +}: let inherit (lib) optionalString boolToString mkIf optionals; inherit (lib.nvim.lua) nullString; diff --git a/modules/ui/colorizer/colorizer.nix b/modules/ui/colorizer/colorizer.nix index 54c932a..80faa40 100644 --- a/modules/ui/colorizer/colorizer.nix +++ b/modules/ui/colorizer/colorizer.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim.ui.colorizer = { enable = mkEnableOption "nvim-colorizer.lua for color highlighting"; diff --git a/modules/ui/colorizer/config.nix b/modules/ui/colorizer/config.nix index 2b2d743..0ee5ef9 100644 --- a/modules/ui/colorizer/config.nix +++ b/modules/ui/colorizer/config.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim boolToString; + cfg = config.vim.ui.colorizer; in { config = mkIf cfg.enable { diff --git a/modules/ui/illuminate/config.nix b/modules/ui/illuminate/config.nix index dcf9ba3..4377622 100644 --- a/modules/ui/illuminate/config.nix +++ b/modules/ui/illuminate/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.ui.illuminate; in { config = mkIf cfg.enable { diff --git a/modules/ui/illuminate/illuminate.nix b/modules/ui/illuminate/illuminate.nix index 952e28c..29426f9 100644 --- a/modules/ui/illuminate/illuminate.nix +++ b/modules/ui/illuminate/illuminate.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption; +in { options.vim.ui.illuminate = { enable = mkEnableOption "vim-illuminate: automatically highlight other uses of the word under the cursor"; }; diff --git a/modules/ui/modes/config.nix b/modules/ui/modes/config.nix index 827eca5..d8483af 100644 --- a/modules/ui/modes/config.nix +++ b/modules/ui/modes/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim boolToString; + cfg = config.vim.ui.modes-nvim; in { config = mkIf cfg.enable { diff --git a/modules/ui/modes/modes.nix b/modules/ui/modes/modes.nix index be4ed50..bfa80b0 100644 --- a/modules/ui/modes/modes.nix +++ b/modules/ui/modes/modes.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim.ui.modes-nvim = { enable = mkEnableOption "modes.nvim's prismatic line decorations"; diff --git a/modules/ui/noice/config.nix b/modules/ui/noice/config.nix index c60fb38..2355497 100644 --- a/modules/ui/noice/config.nix +++ b/modules/ui/noice/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim boolToString; + cfg = config.vim.ui.noice; in { config = mkIf cfg.enable { diff --git a/modules/ui/noice/noice.nix b/modules/ui/noice/noice.nix index 0b3bd71..7afe82c 100644 --- a/modules/ui/noice/noice.nix +++ b/modules/ui/noice/noice.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption; +in { options.vim.ui.noice = { enable = mkEnableOption "noice-nvim UI modification library"; }; diff --git a/modules/ui/notifications/nvim-notify/config.nix b/modules/ui/notifications/nvim-notify/config.nix index 8eb50d8..d291366 100644 --- a/modules/ui/notifications/nvim-notify/config.nix +++ b/modules/ui/notifications/nvim-notify/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.notify.nvim-notify; in { config = mkIf cfg.enable { diff --git a/modules/ui/notifications/nvim-notify/nvim-notify.nix b/modules/ui/notifications/nvim-notify/nvim-notify.nix index 0028a89..0374114 100644 --- a/modules/ui/notifications/nvim-notify/nvim-notify.nix +++ b/modules/ui/notifications/nvim-notify/nvim-notify.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim.notify.nvim-notify = { enable = mkEnableOption "nvim-notify notifications"; stages = mkOption { diff --git a/modules/ui/smartcolumn/config.nix b/modules/ui/smartcolumn/config.nix index 6b611ad..5cf7b74 100644 --- a/modules/ui/smartcolumn/config.nix +++ b/modules/ui/smartcolumn/config.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim concatStringsSep; + cfg = config.vim.ui.smartcolumn; in { config = mkIf cfg.enable { diff --git a/modules/ui/smartcolumn/smartcolumn.nix b/modules/ui/smartcolumn/smartcolumn.nix index 0f01cfc..a105463 100644 --- a/modules/ui/smartcolumn/smartcolumn.nix +++ b/modules/ui/smartcolumn/smartcolumn.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption mkOption types literalExpression; +in { options.vim.ui.smartcolumn = { enable = mkEnableOption "line length indicator"; @@ -17,20 +17,19 @@ with builtins; { }; columnAt = { - languages = lib.mkOption { + languages = mkOption { description = "The position at which smart column should be displayed for each individual buffer type"; - type = lib.types.submodule { - freeformType = with lib.types; attrsOf (either int (listOf int)); + type = types.submodule { + freeformType = with types; attrsOf (either int (listOf int)); }; - example = lib.literalExpression '' + example = literalExpression '' vim.ui.smartcolumn.columnAt.languages = { nix = 110; ruby = 120; java = 130; go = [90 130]; }; - ''; }; }; diff --git a/modules/utility/binds/cheatsheet/cheatsheet.nix b/modules/utility/binds/cheatsheet/cheatsheet.nix index 517f4e2..667fafa 100644 --- a/modules/utility/binds/cheatsheet/cheatsheet.nix +++ b/modules/utility/binds/cheatsheet/cheatsheet.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption; +in { options.vim.binds.cheatsheet = { enable = mkEnableOption "cheatsheet-nvim: searchable cheatsheet for nvim using telescope"; }; diff --git a/modules/utility/binds/cheatsheet/config.nix b/modules/utility/binds/cheatsheet/config.nix index e6d4ea5..b5439a9 100644 --- a/modules/utility/binds/cheatsheet/config.nix +++ b/modules/utility/binds/cheatsheet/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.binds.cheatsheet; in { config = mkIf (cfg.enable) { diff --git a/modules/utility/binds/which-key/config.nix b/modules/utility/binds/which-key/config.nix index 506d888..9aa123d 100644 --- a/modules/utility/binds/which-key/config.nix +++ b/modules/utility/binds/which-key/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.binds.whichKey; in { config = mkIf (cfg.enable) { diff --git a/modules/utility/binds/which-key/which-key.nix b/modules/utility/binds/which-key/which-key.nix index b8e6fa0..ceba7de 100644 --- a/modules/utility/binds/which-key/which-key.nix +++ b/modules/utility/binds/which-key/which-key.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption; +in { options.vim.binds.whichKey = { enable = mkEnableOption "which-key keybind helper menu"; }; diff --git a/modules/utility/ccc/ccc.nix b/modules/utility/ccc/ccc.nix index c0faa55..dab4ec9 100644 --- a/modules/utility/ccc/ccc.nix +++ b/modules/utility/ccc/ccc.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption mkMappingOption; +in { options.vim.utility.ccc = { enable = mkEnableOption "ccc color picker for neovim"; diff --git a/modules/utility/ccc/config.nix b/modules/utility/ccc/config.nix index 1b04618..5318d02 100644 --- a/modules/utility/ccc/config.nix +++ b/modules/utility/ccc/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) addDescriptionsToMappings mkIf nvim; + cfg = config.vim.utility.ccc; self = import ./ccc.nix {inherit lib;}; diff --git a/modules/utility/diffview/config.nix b/modules/utility/diffview/config.nix index 8ce66a0..a572805 100644 --- a/modules/utility/diffview/config.nix +++ b/modules/utility/diffview/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.utility.diffview-nvim; in { config = mkIf (cfg.enable) { diff --git a/modules/utility/diffview/diffview.nix b/modules/utility/diffview/diffview.nix index dd6fae3..4830aba 100644 --- a/modules/utility/diffview/diffview.nix +++ b/modules/utility/diffview/diffview.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption; +in { options.vim.utility.diffview-nvim = { enable = mkEnableOption "diffview-nvim: cycle through diffs for all modified files for any git rev"; }; diff --git a/modules/utility/gestures/gesture-nvim/config.nix b/modules/utility/gestures/gesture-nvim/config.nix index 046c062..a926051 100644 --- a/modules/utility/gestures/gesture-nvim/config.nix +++ b/modules/utility/gestures/gesture-nvim/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetLuaBinding nvim; + cfg = config.vim.gestures.gesture-nvim; self = import ./gesture-nvim.nix {inherit lib;}; diff --git a/modules/utility/gestures/gesture-nvim/gesture-nvim.nix b/modules/utility/gestures/gesture-nvim/gesture-nvim.nix index 06071b8..bd963b3 100644 --- a/modules/utility/gestures/gesture-nvim/gesture-nvim.nix +++ b/modules/utility/gestures/gesture-nvim/gesture-nvim.nix @@ -1,5 +1,6 @@ -{lib, ...}: -with lib; { +{lib, ...}: let + inherit (lib) mkEnableOption mkMappingOption; +in { options.vim.gestures.gesture-nvim = { enable = mkEnableOption "gesture-nvim: mouse gestures"; diff --git a/modules/utility/icon-picker/config.nix b/modules/utility/icon-picker/config.nix index 75c1490..642c9a4 100644 --- a/modules/utility/icon-picker/config.nix +++ b/modules/utility/icon-picker/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.utility.icon-picker; in { config = mkIf (cfg.enable) { diff --git a/modules/utility/icon-picker/icon-picker.nix b/modules/utility/icon-picker/icon-picker.nix index 29aee8e..94e16be 100644 --- a/modules/utility/icon-picker/icon-picker.nix +++ b/modules/utility/icon-picker/icon-picker.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption; +in { options.vim.utility.icon-picker = { enable = mkEnableOption "nerdfonts icon picker for nvim"; }; diff --git a/modules/utility/motion/hop/config.nix b/modules/utility/motion/hop/config.nix index a5aa92c..34015dc 100644 --- a/modules/utility/motion/hop/config.nix +++ b/modules/utility/motion/hop/config.nix @@ -2,8 +2,9 @@ config, lib, ... -}: -with lib; let +}: let + inherit (lib) addDescriptionsToMappings mkIf mkSetBinding nvim; + cfg = config.vim.utility.motion.hop; self = import ./hop.nix {inherit lib;}; diff --git a/modules/utility/motion/hop/hop.nix b/modules/utility/motion/hop/hop.nix index 1eef3f8..ada8bc3 100644 --- a/modules/utility/motion/hop/hop.nix +++ b/modules/utility/motion/hop/hop.nix @@ -1,5 +1,6 @@ -{lib, ...}: -with lib; { +{lib, ...}: let + inherit (lib) mkMappingOption mkEnableOption; +in { options.vim.utility.motion.hop = { mappings = { hop = mkMappingOption "Jump to occurences [hop.nvim]" "h"; diff --git a/modules/utility/motion/leap/config.nix b/modules/utility/motion/leap/config.nix index 4a6c571..4bfa3e8 100644 --- a/modules/utility/motion/leap/config.nix +++ b/modules/utility/motion/leap/config.nix @@ -2,8 +2,9 @@ config, lib, ... -}: -with lib; let +}: let + inherit (lib) mkIf mkMerge mkBinding nvim; + cfg = config.vim.utility.motion.leap; in { config = mkIf cfg.enable { diff --git a/modules/utility/motion/leap/leap.nix b/modules/utility/motion/leap/leap.nix index 3ff9302..6f00822 100644 --- a/modules/utility/motion/leap/leap.nix +++ b/modules/utility/motion/leap/leap.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim.utility.motion.leap = { enable = mkEnableOption "leap.nvim plugin (easy motion)"; diff --git a/modules/utility/surround/config.nix b/modules/utility/surround/config.nix index aa7f7bd..78ec0a8 100644 --- a/modules/utility/surround/config.nix +++ b/modules/utility/surround/config.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetBinding nvim; + cfg = config.vim.utility.surround; self = import ./surround.nix {inherit lib config;}; mappingDefinitions = self.options.vim.utility.surround.mappings; diff --git a/modules/utility/surround/surround.nix b/modules/utility/surround/surround.nix index 405e3f2..7b20fb4 100644 --- a/modules/utility/surround/surround.nix +++ b/modules/utility/surround/surround.nix @@ -2,9 +2,9 @@ lib, config, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkOption types mkIf mkDefault; +in { options.vim.utility.surround = { enable = mkOption { type = types.bool; diff --git a/modules/utility/telescope/config.nix b/modules/utility/telescope/config.nix index 0156a0d..53cde96 100644 --- a/modules/utility/telescope/config.nix +++ b/modules/utility/telescope/config.nix @@ -3,9 +3,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) addDescriptionsToMappings mkIf mkMerge mkSetBinding nvim; + cfg = config.vim.telescope; self = import ./telescope.nix {inherit lib;}; mappingDefinitions = self.options.vim.telescope.mappings; diff --git a/modules/utility/telescope/telescope.nix b/modules/utility/telescope/telescope.nix index 39d399b..12ea887 100644 --- a/modules/utility/telescope/telescope.nix +++ b/modules/utility/telescope/telescope.nix @@ -1,6 +1,6 @@ -{lib, ...}: -with lib; -with builtins; { +{lib, ...}: let + inherit (lib) mkMappingOption mkEnableOption; +in { options.vim.telescope = { mappings = { findProjects = mkMappingOption "Find files [Telescope]" "fp"; diff --git a/modules/utility/wakatime/config.nix b/modules/utility/wakatime/config.nix index fb99074..69063e2 100644 --- a/modules/utility/wakatime/config.nix +++ b/modules/utility/wakatime/config.nix @@ -3,9 +3,9 @@ lib, pkgs, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkIf nvim; + cfg = config.vim.utility.vim-wakatime; in { config = mkIf (cfg.enable) { diff --git a/modules/utility/wakatime/vim-wakatime.nix b/modules/utility/wakatime/vim-wakatime.nix index 496e929..f0f42b9 100644 --- a/modules/utility/wakatime/vim-wakatime.nix +++ b/modules/utility/wakatime/vim-wakatime.nix @@ -2,9 +2,9 @@ lib, pkgs, ... -}: -with lib; -with builtins; { +}: let + inherit (lib) mkEnableOption mkOption types; +in { options.vim.utility.vim-wakatime = { enable = mkEnableOption "vim-wakatime: live code statistics"; diff --git a/modules/visuals/config.nix b/modules/visuals/config.nix index ab580ca..5cdd4f4 100644 --- a/modules/visuals/config.nix +++ b/modules/visuals/config.nix @@ -2,8 +2,9 @@ config, lib, ... -}: -with lib; let +}: let + inherit (lib) mkIf mkMerge nvim optionalString boolToString mkBinding; + cfg = config.vim.visuals; in { config = mkIf cfg.enable (mkMerge [ diff --git a/modules/visuals/visuals.nix b/modules/visuals/visuals.nix index f77e470..97ace23 100644 --- a/modules/visuals/visuals.nix +++ b/modules/visuals/visuals.nix @@ -2,9 +2,9 @@ config, lib, ... -}: -with lib; -with builtins; let +}: let + inherit (lib) mkEnableOption mkMappingOption mkOption types literalExpression; + cfg = config.vim.visuals; in { options.vim.visuals = {