From 2f09998b654db4fd9c81d11ece3a40d74e7bf3ac Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 20 Sep 2024 19:56:35 -0500 Subject: [PATCH] plugins/otter: add autoActivate --- plugins/by-name/otter/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/by-name/otter/default.nix b/plugins/by-name/otter/default.nix index cc38adb1..f6bcfcb0 100644 --- a/plugins/by-name/otter/default.nix +++ b/plugins/by-name/otter/default.nix @@ -83,6 +83,14 @@ helpers.neovim-plugin.mkNeovimPlugin { ''; }; + extraOptions = { + autoActivate = lib.mkOption { + type = lib.types.bool; + description = "When enabled, activate otter automatically when lsp is attached."; + default = true; + }; + }; + extraConfig = cfg: { warnings = lib.optional (cfg.enable && config.plugins.treesitter.settings.highlight.enable == null) @@ -90,6 +98,10 @@ helpers.neovim-plugin.mkNeovimPlugin { NixVim(plugins.otter): you have enabled otter, but `plugins.treesitter.settings.highlight.enable` is not enabled. Otter functionality might not work as expected without it and `plugins.treesitter.enable` enabled. ''; + + plugins.lsp.onAttach = lib.mkIf cfg.autoActivate '' + require('otter').activate() + ''; }; }