neovim-flake/modules/plugins/lsp/otter/config.nix

31 lines
751 B
Nix
Raw Normal View History

2024-09-27 09:27:58 +02:00
{
config,
lib,
...
}: let
2024-09-27 09:46:30 +02:00
inherit (lib.modules) mkIf mkMerge;
2024-09-27 09:27:58 +02:00
inherit (lib.nvim.dag) entryAnywhere;
2024-09-27 09:46:30 +02:00
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
2024-09-27 09:27:58 +02:00
cfg = config.vim.lsp;
2024-09-27 09:46:30 +02:00
self = import ./otter.nix {inherit lib;};
mappingDefinitions = self.options.vim.lsp.otter.mappings;
mappings = addDescriptionsToMappings cfg.otter.mappings mappingDefinitions;
2024-09-27 09:27:58 +02:00
in {
config = mkIf (cfg.enable && cfg.otter.enable) {
vim = {
2024-09-27 10:32:07 +02:00
startPlugins = ["otter-nvim"];
2024-09-27 09:27:58 +02:00
2024-09-27 09:46:30 +02:00
maps.normal = mkMerge [
(mkSetBinding mappings.toggle "<cmd>lua require'otter'.activate()<CR>")
];
pluginRC.otter = entryAnywhere ''
-- Enable otter diagnostics viewer
2024-09-27 10:32:07 +02:00
require("otter").setup()
2024-09-27 09:27:58 +02:00
'';
};
};
}