mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-01-07 11:17:15 +00:00
feat(docs-view): custom setup
This commit is contained in:
parent
4b79ed6ef6
commit
08a4c94c99
2 changed files with 45 additions and 37 deletions
|
|
@ -4,7 +4,6 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIf nvim addDescriptionsToMappings mkSetBinding mkMerge;
|
inherit (lib) mkIf nvim addDescriptionsToMappings mkSetBinding mkMerge;
|
||||||
inherit (builtins) toString;
|
|
||||||
|
|
||||||
cfg = config.vim.lsp.nvim-docs-view;
|
cfg = config.vim.lsp.nvim-docs-view;
|
||||||
self = import ./nvim-docs-view.nix {inherit lib;};
|
self = import ./nvim-docs-view.nix {inherit lib;};
|
||||||
|
|
@ -18,12 +17,7 @@ in {
|
||||||
startPlugins = ["nvim-docs-view"];
|
startPlugins = ["nvim-docs-view"];
|
||||||
|
|
||||||
luaConfigRC.nvim-docs-view = nvim.dag.entryAnywhere ''
|
luaConfigRC.nvim-docs-view = nvim.dag.entryAnywhere ''
|
||||||
require("docs-view").setup {
|
require("docs-view").setup ${nvim.lua.expToLua cfg.setupOpts}
|
||||||
position = "${cfg.position}",
|
|
||||||
width = ${toString cfg.width},
|
|
||||||
height = ${toString cfg.height},
|
|
||||||
update_mode = "${cfg.updateMode}",
|
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
maps.normal = mkMerge [
|
maps.normal = mkMerge [
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,22 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib) mkEnableOption mkOption types mkMappingOption;
|
inherit (lib) mkEnableOption mkOption types mkMappingOption mkRenamedOptionModule;
|
||||||
in {
|
in {
|
||||||
options.vim.lsp.nvim-docs-view = {
|
options.vim.lsp.nvim-docs-view = {
|
||||||
enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel.";
|
enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel.";
|
||||||
|
|
||||||
|
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"])
|
||||||
|
];
|
||||||
|
|
||||||
|
setupOpts = lib.nvim.types.mkPluginSetupOption "nvim-docs-view" {
|
||||||
position = mkOption {
|
position = mkOption {
|
||||||
type = types.enum ["left" "right" "top" "bottom"];
|
type = types.enum ["left" "right" "top" "bottom"];
|
||||||
default = "right";
|
default = "right";
|
||||||
|
|
@ -28,7 +41,7 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
updateMode = mkOption {
|
update_mode = mkOption {
|
||||||
type = types.enum ["auto" "manual"];
|
type = types.enum ["auto" "manual"];
|
||||||
default = "auto";
|
default = "auto";
|
||||||
description = ''
|
description = ''
|
||||||
|
|
@ -37,6 +50,7 @@ in {
|
||||||
- If manual, the content will only update once :DocsViewUpdate is called
|
- If manual, the content will only update once :DocsViewUpdate is called
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
mappings = {
|
mappings = {
|
||||||
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt";
|
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue