From da4b1d4bbe1f75905aa5d5a835a8f0afa7afdfd9 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 1 Feb 2025 07:31:29 +0300 Subject: [PATCH] diagnostics/nvim-lint: init --- modules/plugins/diagnostics/default.nix | 3 +++ .../plugins/diagnostics/nvim-lint/config.nix | 20 ++++++++++++++ .../plugins/diagnostics/nvim-lint/default.nix | 6 +++++ .../diagnostics/nvim-lint/nvim-lint.nix | 27 +++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 modules/plugins/diagnostics/default.nix create mode 100644 modules/plugins/diagnostics/nvim-lint/config.nix create mode 100644 modules/plugins/diagnostics/nvim-lint/default.nix create mode 100644 modules/plugins/diagnostics/nvim-lint/nvim-lint.nix diff --git a/modules/plugins/diagnostics/default.nix b/modules/plugins/diagnostics/default.nix new file mode 100644 index 00000000..3789640d --- /dev/null +++ b/modules/plugins/diagnostics/default.nix @@ -0,0 +1,3 @@ +{ + imports = [./nvim-lint]; +} diff --git a/modules/plugins/diagnostics/nvim-lint/config.nix b/modules/plugins/diagnostics/nvim-lint/config.nix new file mode 100644 index 00000000..dac2c2f4 --- /dev/null +++ b/modules/plugins/diagnostics/nvim-lint/config.nix @@ -0,0 +1,20 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.lua) toLuaObject; + + cfg = config.vim.diagnostics.nvim-lint; +in { + config = mkIf cfg.enable { + vim = { + startPlugins = ["nvim-lint"]; + pluginRC.nvim-lint = entryAnywhere '' + require("lint").setup(${toLuaObject cfg.setupOpts}) + ''; + }; + }; +} diff --git a/modules/plugins/diagnostics/nvim-lint/default.nix b/modules/plugins/diagnostics/nvim-lint/default.nix new file mode 100644 index 00000000..00c526f1 --- /dev/null +++ b/modules/plugins/diagnostics/nvim-lint/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./nvim-lint.nix + ./config.nix + ]; +} diff --git a/modules/plugins/diagnostics/nvim-lint/nvim-lint.nix b/modules/plugins/diagnostics/nvim-lint/nvim-lint.nix new file mode 100644 index 00000000..2211211e --- /dev/null +++ b/modules/plugins/diagnostics/nvim-lint/nvim-lint.nix @@ -0,0 +1,27 @@ +{lib, ...}: let + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) attrsOf listOf str; + inherit (lib.nvim.types) mkPluginSetupOption; +in { + options.vim.diagnostics.nvim-lint = { + enable = mkEnableOption "asynchronous linter plugin for Neovim [nvim-lint]"; + setupOpts = mkPluginSetupOption "nvim-lint" { + linters_by_ft = mkOption { + type = attrsOf (listOf str); + default = {}; + example = { + text = ["vale"]; + markdown = ["vale"]; + }; + + description = '' + Map of filetype to formatters. This option takes a set of + `key = value` format where the `value` will be converted + to its Lua equivalent. You are responsible for passing the + correct Nix data types to generate a correct Lua value that + conform is able to accept. + ''; + }; + }; + }; +}