mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
feat(docs-view): custom setup
This commit is contained in:
parent
379231b43d
commit
62b0791b75
2 changed files with 47 additions and 40 deletions
|
@ -3,10 +3,10 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toString;
|
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
|
||||||
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetBinding;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
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;};
|
||||||
|
@ -20,12 +20,7 @@ in {
|
||||||
startPlugins = ["nvim-docs-view"];
|
startPlugins = ["nvim-docs-view"];
|
||||||
|
|
||||||
luaConfigRC.nvim-docs-view = entryAnywhere ''
|
luaConfigRC.nvim-docs-view = entryAnywhere ''
|
||||||
require("docs-view").setup {
|
require("docs-view").setup ${toLuaObject cfg.setupOpts}
|
||||||
position = "${cfg.position}",
|
|
||||||
width = ${toString cfg.width},
|
|
||||||
height = ${toString cfg.height},
|
|
||||||
update_mode = "${cfg.updateMode}",
|
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
maps.normal = mkMerge [
|
maps.normal = mkMerge [
|
||||||
|
|
|
@ -1,45 +1,57 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkEnableOption mkOption;
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
inherit (lib.types) enum int;
|
|
||||||
inherit (lib.nvim.binds) mkMappingOption;
|
inherit (lib.nvim.binds) mkMappingOption;
|
||||||
|
inherit (lib) types mkRenamedOptionModule;
|
||||||
in {
|
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 = {
|
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.";
|
||||||
|
|
||||||
position = mkOption {
|
setupOpts = lib.nvim.types.mkPluginSetupOption "nvim-docs-view" {
|
||||||
type = enum ["left" "right" "top" "bottom"];
|
position = mkOption {
|
||||||
default = "right";
|
type = types.enum ["left" "right" "top" "bottom"];
|
||||||
description = ''
|
default = "right";
|
||||||
Where to open the docs view panel
|
description = ''
|
||||||
'';
|
Where to open the docs view panel
|
||||||
};
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
height = mkOption {
|
height = mkOption {
|
||||||
type = int;
|
type = types.int;
|
||||||
default = 10;
|
default = 10;
|
||||||
description = ''
|
description = ''
|
||||||
Height of the docs view panel if the position is set to either top or bottom
|
Height of the docs view panel if the position is set to either top or bottom
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
width = mkOption {
|
width = mkOption {
|
||||||
type = int;
|
type = types.int;
|
||||||
default = 60;
|
default = 60;
|
||||||
description = ''
|
description = ''
|
||||||
Width of the docs view panel if the position is set to either left or right
|
Width of the docs view panel if the position is set to either left or right
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
updateMode = mkOption {
|
update_mode = mkOption {
|
||||||
type = enum ["auto" "manual"];
|
type = types.enum ["auto" "manual"];
|
||||||
default = "auto";
|
default = "auto";
|
||||||
description = ''
|
description = ''
|
||||||
Determines the mechanism used to update the docs view panel content
|
Determines the mechanism used to update the docs view panel content.
|
||||||
|
- If auto, the content will update upon cursor move.
|
||||||
Possible values:
|
- If manual, the content will only update once :DocsViewUpdate is called
|
||||||
- auto: the content will update upon cursor move.
|
'';
|
||||||
- manual: the content will only update once :DocsViewUpdate is called
|
};
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mappings = {
|
mappings = {
|
||||||
|
|
Loading…
Reference in a new issue