neovim-flake/modules/plugins/lsp/nvim-docs-view/config.nix

33 lines
881 B
Nix
Raw Permalink Normal View History

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