nvf/modules/plugins/lsp/otter/config.nix

40 lines
1.1 KiB
Nix
Raw Normal View History

2024-09-27 07:27:58 +00:00
{
config,
lib,
...
}: let
2024-09-27 07:46:30 +00:00
inherit (lib.modules) mkIf mkMerge;
2024-09-27 07:27:58 +00:00
inherit (lib.nvim.dag) entryAnywhere;
2024-09-27 19:31:39 +00:00
inherit (lib.nvim.lua) toLuaObject;
2024-09-27 07:46:30 +00:00
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
2024-09-27 07:27:58 +00:00
cfg = config.vim.lsp;
2024-09-27 07:46:30 +00:00
self = import ./otter.nix {inherit lib;};
mappingDefinitions = self.options.vim.lsp.otter-nvim.mappings;
mappings = addDescriptionsToMappings cfg.otter-nvim.mappings mappingDefinitions;
2024-09-27 07:27:58 +00:00
in {
config = mkIf (cfg.enable && cfg.otter-nvim.enable) {
assertions = [
{
assertion = !config.vim.utility.ccc.enable;
message = ''
ccc and otter have a breaking conflict. It's been reported upstream. Until it's fixed, disable one of them
'';
}
];
2024-09-27 07:27:58 +00:00
vim = {
2024-09-27 08:32:07 +00:00
startPlugins = ["otter-nvim"];
2024-09-27 07:27:58 +00:00
2024-09-27 07:46:30 +00:00
maps.normal = mkMerge [
(mkSetBinding mappings.toggle "<cmd>lua require'otter'.activate()<CR>")
];
pluginRC.otter-nvim = entryAnywhere ''
2024-09-27 07:46:30 +00:00
-- Enable otter diagnostics viewer
2024-09-27 19:31:39 +00:00
require("otter").setup({${toLuaObject cfg.otter-nvim.setupOpts}})
2024-09-27 07:27:58 +00:00
'';
};
};
}