2023-10-26 12:03:58 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
2024-03-12 00:46:29 +00:00
|
|
|
inherit (lib.modules) mkIf mkMerge;
|
|
|
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
2024-02-17 15:10:45 +00:00
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
|
|
|
inherit (lib.nvim.lua) toLuaObject;
|
2023-10-26 12:03:58 +00:00
|
|
|
|
|
|
|
cfg = config.vim.lsp.nvim-docs-view;
|
2023-10-27 06:30:20 +00:00
|
|
|
self = import ./nvim-docs-view.nix {inherit lib;};
|
|
|
|
|
|
|
|
mappingDefinitions = self.options.vim.lsp.nvim-docs-view.mappings;
|
|
|
|
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
2023-10-26 12:03:58 +00:00
|
|
|
in {
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
vim = {
|
|
|
|
lsp.enable = true;
|
|
|
|
startPlugins = ["nvim-docs-view"];
|
|
|
|
|
2024-03-12 00:46:29 +00:00
|
|
|
luaConfigRC.nvim-docs-view = entryAnywhere ''
|
2024-02-17 15:10:45 +00:00
|
|
|
require("docs-view").setup ${toLuaObject cfg.setupOpts}
|
2023-10-26 12:03:58 +00:00
|
|
|
'';
|
2023-10-27 06:30:20 +00:00
|
|
|
|
|
|
|
maps.normal = mkMerge [
|
|
|
|
(mkSetBinding mappings.viewToggle "<cmd>DocsViewToggle<CR>")
|
|
|
|
(mkSetBinding mappings.viewUpdate "<cmd>DocsViewUpdate<CR>")
|
|
|
|
];
|
2023-10-26 12:03:58 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|