mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 18:31:35 +00:00
treewide: begin restructuring the module tree
This commit is contained in:
parent
e1835f6c46
commit
7c730a78e5
254 changed files with 749 additions and 664 deletions
32
modules/plugins/lsp/nvim-docs-view/config.nix
Normal file
32
modules/plugins/lsp/nvim-docs-view/config.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.lsp.nvim-docs-view;
|
||||
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 ''
|
||||
require("docs-view").setup ${toLuaObject cfg.setupOpts}
|
||||
'';
|
||||
|
||||
maps.normal = mkMerge [
|
||||
(mkSetBinding mappings.viewToggle "<cmd>DocsViewToggle<CR>")
|
||||
(mkSetBinding mappings.viewUpdate "<cmd>DocsViewUpdate<CR>")
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/lsp/nvim-docs-view/default.nix
Normal file
6
modules/plugins/lsp/nvim-docs-view/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./nvim-docs-view.nix
|
||||
];
|
||||
}
|
62
modules/plugins/lsp/nvim-docs-view/nvim-docs-view.nix
Normal file
62
modules/plugins/lsp/nvim-docs-view/nvim-docs-view.nix
Normal file
|
@ -0,0 +1,62 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib) types mkRenamedOptionModule;
|
||||
in {
|
||||
imports = let
|
||||
renamedSetupOption = oldPath: newPath:
|
||||
mkRenamedOptionModule
|
||||
(["vim" "lsp" "nvim-docs-view"] ++ oldPath)
|
||||
(["vim" "lsp" "nvim-docs-view" "setupOpts"] ++ newPath);
|
||||
in [
|
||||
(renamedSetupOption ["position"] ["position"])
|
||||
(renamedSetupOption ["width"] ["width"])
|
||||
(renamedSetupOption ["height"] ["height"])
|
||||
(renamedSetupOption ["updateMode"] ["update_mode"])
|
||||
];
|
||||
|
||||
options.vim.lsp.nvim-docs-view = {
|
||||
enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel.";
|
||||
|
||||
setupOpts = lib.nvim.types.mkPluginSetupOption "nvim-docs-view" {
|
||||
position = mkOption {
|
||||
type = types.enum ["left" "right" "top" "bottom"];
|
||||
default = "right";
|
||||
description = ''
|
||||
Where to open the docs view panel
|
||||
'';
|
||||
};
|
||||
|
||||
height = mkOption {
|
||||
type = types.int;
|
||||
default = 10;
|
||||
description = ''
|
||||
Height of the docs view panel if the position is set to either top or bottom
|
||||
'';
|
||||
};
|
||||
|
||||
width = mkOption {
|
||||
type = types.int;
|
||||
default = 60;
|
||||
description = ''
|
||||
Width of the docs view panel if the position is set to either left or right
|
||||
'';
|
||||
};
|
||||
|
||||
update_mode = mkOption {
|
||||
type = types.enum ["auto" "manual"];
|
||||
default = "auto";
|
||||
description = ''
|
||||
Determines the mechanism used to update the docs view panel content.
|
||||
- If auto, the content will update upon cursor move.
|
||||
- If manual, the content will only update once :DocsViewUpdate is called
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
mappings = {
|
||||
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt";
|
||||
viewUpdate = mkMappingOption "Manually update the docs view panel" "lvu";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue