From d61aba1e122a2e2540c286b94701340ff459384d Mon Sep 17 00:00:00 2001 From: Soliprem Date: Fri, 27 Sep 2024 09:46:30 +0200 Subject: [PATCH] created otter file --- modules/plugins/lsp/otter/config.nix | 15 ++++++++++++--- modules/plugins/lsp/otter/default.nix | 13 +++++-------- modules/plugins/lsp/otter/otter.nix | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 modules/plugins/lsp/otter/otter.nix diff --git a/modules/plugins/lsp/otter/config.nix b/modules/plugins/lsp/otter/config.nix index 8857d32..3025d45 100644 --- a/modules/plugins/lsp/otter/config.nix +++ b/modules/plugins/lsp/otter/config.nix @@ -3,17 +3,26 @@ lib, ... }: let - inherit (lib.modules) mkIf; + inherit (lib.modules) mkIf mkMerge; inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding; cfg = config.vim.lsp; + + self = import ./otter.nix {inherit lib;}; + mappingDefinitions = self.options.vim.lsp.otter.mappings; + mappings = addDescriptionsToMappings cfg.otter.mappings mappingDefinitions; in { config = mkIf (cfg.enable && cfg.otter.enable) { vim = { startPlugins = ["otter"]; - pluginRC.trouble = entryAnywhere '' - -- Enable Otter + maps.normal = mkMerge [ + (mkSetBinding mappings.toggle "lua require'otter'.activate()") + ]; + + pluginRC.otter = entryAnywhere '' + -- Enable otter diagnostics viewer require("otter").setup {} ''; }; diff --git a/modules/plugins/lsp/otter/default.nix b/modules/plugins/lsp/otter/default.nix index 1432d8c..935f144 100644 --- a/modules/plugins/lsp/otter/default.nix +++ b/modules/plugins/lsp/otter/default.nix @@ -1,9 +1,6 @@ -{lib, ...}: let - inherit (lib.options) mkEnableOption; -in { - options.vim.lsp = { - otter = { - enable = mkEnableOption "trouble lsp for markup languages"; - }; - }; +{ + imports = [ + ./otter.nix + ./config.nix + ]; } diff --git a/modules/plugins/lsp/otter/otter.nix b/modules/plugins/lsp/otter/otter.nix new file mode 100644 index 0000000..a352da7 --- /dev/null +++ b/modules/plugins/lsp/otter/otter.nix @@ -0,0 +1,14 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.binds) mkMappingOption; +in { + options.vim.lsp = { + trouble = { + enable = mkEnableOption "Otter LSP Injector"; + + mappings = { + toggle = mkMappingOption "Activate LSP on Cursor Position [otter]" "oa"; + }; + }; + }; +}