2023-07-20 15:34:36 +00:00
|
|
|
{
|
|
|
|
config,
|
2024-03-16 13:25:30 +00:00
|
|
|
lib,
|
2023-07-20 15:34:36 +00:00
|
|
|
...
|
|
|
|
}: let
|
2024-03-16 13:25:30 +00:00
|
|
|
inherit (lib.options) mkOption mkEnableOption;
|
2024-09-13 16:34:21 +00:00
|
|
|
inherit (lib.types) nullOr listOf enum bool str int either;
|
2024-03-10 18:37:49 +00:00
|
|
|
inherit (lib.modules) mkRenamedOptionModule;
|
2024-09-13 16:34:21 +00:00
|
|
|
inherit (lib.nvim.types) mkPluginSetupOption borderType;
|
2024-03-10 18:40:33 +00:00
|
|
|
mkSimpleIconOption = default:
|
|
|
|
mkOption {
|
|
|
|
inherit default;
|
|
|
|
type = str;
|
|
|
|
description = "";
|
|
|
|
};
|
2023-07-20 15:34:36 +00:00
|
|
|
in {
|
2024-03-10 18:37:49 +00:00
|
|
|
imports = let
|
|
|
|
renameSetupOpt = oldPath: newPath:
|
|
|
|
mkRenamedOptionModule
|
|
|
|
(["vim" "ui" "breadcrumbs" "navbuddy"] ++ oldPath)
|
|
|
|
(["vim" "ui" "breadcrumbs" "navbuddy" "setupOpts"] ++ newPath);
|
|
|
|
in [
|
|
|
|
(renameSetupOpt ["useDefaultMappings"] ["use_default_mappings"])
|
|
|
|
(renameSetupOpt ["window"] ["window"])
|
|
|
|
(renameSetupOpt ["nodeMarkers"] ["node_markers"])
|
|
|
|
(renameSetupOpt ["lsp" "autoAttach"] ["lsp" "auto_attach"])
|
|
|
|
(renameSetupOpt ["lsp" "preference"] ["lsp" "preference"])
|
|
|
|
(renameSetupOpt ["sourceBuffer" "followNode"] ["source_buffer" "follow_node"])
|
|
|
|
(renameSetupOpt ["sourceBuffer" "highlight"] ["source_buffer" "highlight"])
|
|
|
|
(renameSetupOpt ["sourceBuffer" "reorient"] ["source_buffer" "reorient"])
|
|
|
|
(renameSetupOpt ["sourceBuffer" "scrolloff"] ["source_buffer" "scrolloff"])
|
|
|
|
# TODO: every option under icon is renamed to first letter capitalized
|
|
|
|
(renameSetupOpt ["icon"] ["icon"])
|
2024-09-13 17:54:08 +00:00
|
|
|
|
|
|
|
(mkRenamedOptionModule ["vim" "ui" "breadcrumbs" "alwaysRender"] ["vim" "ui" "breadcrumbs" "lualine" "winbar" "alwaysRender"])
|
2024-03-10 18:37:49 +00:00
|
|
|
];
|
|
|
|
|
2023-07-19 19:49:06 +00:00
|
|
|
options.vim.ui.breadcrumbs = {
|
2024-03-16 13:25:30 +00:00
|
|
|
enable = mkEnableOption "breadcrumbs";
|
2023-07-24 18:36:01 +00:00
|
|
|
source = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = nullOr (enum ["nvim-navic"]); # TODO: lspsaga and dropbar
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "nvim-navic";
|
|
|
|
description = ''
|
2023-07-28 14:08:42 +00:00
|
|
|
The source to be used for breadcrumbs component. Null means no breadcrumbs.
|
2023-07-24 18:36:01 +00:00
|
|
|
'';
|
|
|
|
};
|
2023-07-20 15:34:36 +00:00
|
|
|
|
2024-09-13 17:54:08 +00:00
|
|
|
# Options for configuring Lualine integration of nvim-navic
|
|
|
|
lualine.winbar = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = bool;
|
|
|
|
default = true; # for retaining previous behaviour
|
|
|
|
example = false;
|
|
|
|
description = ''
|
|
|
|
Whether to automatically configure a winbar component for
|
|
|
|
Lualine on the Winbar section.
|
|
|
|
|
|
|
|
::: {.note}
|
|
|
|
This is **set to `true` by default**, which means nvim-navic
|
|
|
|
will occupy `winbar.lualine_c` for the breadcrumbs feature
|
|
|
|
unless this option is set to `false`.
|
|
|
|
:::
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
alwaysRender = mkOption {
|
|
|
|
type = bool;
|
|
|
|
default = true;
|
|
|
|
example = false;
|
|
|
|
description = ''
|
|
|
|
Whether to always display the breadcrumbs component
|
|
|
|
on winbar.
|
|
|
|
|
|
|
|
::: {.note}
|
|
|
|
This will pass `draw_empty` to the `nvim_navic` winbar
|
|
|
|
component, which causes the component to be drawn even
|
|
|
|
if it's empty
|
|
|
|
:::
|
|
|
|
'';
|
|
|
|
};
|
2023-07-21 19:35:05 +00:00
|
|
|
};
|
|
|
|
|
2023-07-20 15:34:36 +00:00
|
|
|
navbuddy = {
|
2023-07-28 14:08:42 +00:00
|
|
|
enable = mkEnableOption "navbuddy LSP helper UI. Enabling this option automatically loads and enables nvim-navic";
|
2023-07-24 18:36:01 +00:00
|
|
|
mappings = {
|
|
|
|
close = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "<esc>";
|
|
|
|
description = "keybinding to close Navbuddy UI";
|
|
|
|
};
|
|
|
|
|
|
|
|
nextSibling = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "j";
|
|
|
|
description = "keybinding to navigate to the next sibling node";
|
|
|
|
};
|
|
|
|
|
|
|
|
previousSibling = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "k";
|
|
|
|
description = "keybinding to navigate to the previous sibling node";
|
|
|
|
};
|
|
|
|
|
|
|
|
parent = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "h";
|
|
|
|
description = "keybinding to navigate to the parent node";
|
|
|
|
};
|
|
|
|
|
|
|
|
children = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2024-03-10 18:37:49 +00:00
|
|
|
default = "l";
|
2023-07-24 18:36:01 +00:00
|
|
|
description = "keybinding to navigate to the child node";
|
|
|
|
};
|
|
|
|
|
|
|
|
root = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "0";
|
|
|
|
description = "keybinding to navigate to the root node";
|
|
|
|
};
|
|
|
|
|
|
|
|
visualName = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "v";
|
|
|
|
description = "visual selection of name";
|
|
|
|
};
|
|
|
|
|
|
|
|
visualScope = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "V";
|
|
|
|
description = "visual selection of scope";
|
|
|
|
};
|
|
|
|
|
|
|
|
yankName = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "y";
|
|
|
|
description = "yank the name to system clipboard";
|
|
|
|
};
|
|
|
|
|
|
|
|
yankScope = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "Y";
|
|
|
|
description = "yank the scope to system clipboard";
|
|
|
|
};
|
|
|
|
|
|
|
|
insertName = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "i";
|
|
|
|
description = "insert at start of name";
|
|
|
|
};
|
|
|
|
|
|
|
|
insertScope = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "I";
|
|
|
|
description = "insert at start of scope";
|
|
|
|
};
|
|
|
|
|
|
|
|
appendName = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "a";
|
|
|
|
description = "insert at end of name";
|
|
|
|
};
|
|
|
|
|
|
|
|
appendScope = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "A";
|
|
|
|
description = "insert at end of scope";
|
|
|
|
};
|
|
|
|
|
|
|
|
rename = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "r";
|
|
|
|
description = "rename the node";
|
|
|
|
};
|
|
|
|
|
|
|
|
delete = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "d";
|
|
|
|
description = "delete the node";
|
|
|
|
};
|
|
|
|
|
|
|
|
foldCreate = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "f";
|
|
|
|
description = "create a new fold";
|
|
|
|
};
|
|
|
|
|
|
|
|
foldDelete = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "F";
|
|
|
|
description = "delete the current fold";
|
|
|
|
};
|
|
|
|
|
|
|
|
comment = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "c";
|
|
|
|
description = "comment the node";
|
|
|
|
};
|
|
|
|
|
|
|
|
select = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "<enter>";
|
|
|
|
description = "goto selected symbol";
|
|
|
|
};
|
|
|
|
|
|
|
|
moveDown = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "J";
|
|
|
|
description = "move focused node down";
|
|
|
|
};
|
|
|
|
|
|
|
|
moveUp = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "K";
|
|
|
|
description = "move focused node up";
|
|
|
|
};
|
|
|
|
|
|
|
|
telescope = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "t";
|
|
|
|
description = "fuzzy finder at current level";
|
|
|
|
};
|
|
|
|
|
|
|
|
help = mkOption {
|
2024-03-16 13:25:30 +00:00
|
|
|
type = str;
|
2023-07-24 18:36:01 +00:00
|
|
|
default = "g?";
|
|
|
|
description = "open mapping help window";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
setupOpts = mkPluginSetupOption "navbuddy" {
|
|
|
|
useDefaultMappings = mkOption {
|
|
|
|
type = bool;
|
|
|
|
default = true;
|
|
|
|
description = "use default Navbuddy keybindings (disables user-specified keybinds)";
|
2023-07-20 15:34:36 +00:00
|
|
|
};
|
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
window = {
|
|
|
|
# size = {}
|
|
|
|
# position = {}
|
2023-07-28 12:59:16 +00:00
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
border = mkOption {
|
2024-09-13 16:34:21 +00:00
|
|
|
type = borderType;
|
2024-03-10 18:37:49 +00:00
|
|
|
default = config.vim.ui.borders.globalStyle;
|
|
|
|
description = "border style to use";
|
2023-07-20 15:34:36 +00:00
|
|
|
};
|
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
scrolloff = mkOption {
|
|
|
|
type = nullOr int;
|
|
|
|
default = null;
|
|
|
|
description = "Scrolloff value within navbuddy window";
|
|
|
|
};
|
2023-07-28 12:59:16 +00:00
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
sections = {
|
|
|
|
# left section
|
|
|
|
left = {
|
|
|
|
/*
|
|
|
|
size = mkOption {
|
|
|
|
type = nullOr (intBetween 0 100);
|
|
|
|
default = null;
|
|
|
|
description = "size of the left section of Navbuddy UI in percentage (0-100)";
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
|
|
|
border = mkOption {
|
2024-09-13 16:34:21 +00:00
|
|
|
type = borderType;
|
2024-03-10 18:37:49 +00:00
|
|
|
default = config.vim.ui.borders.globalStyle;
|
|
|
|
description = "border style to use for the left section of Navbuddy UI";
|
|
|
|
};
|
2023-07-20 15:34:36 +00:00
|
|
|
};
|
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
# middle section
|
|
|
|
mid = {
|
|
|
|
/*
|
|
|
|
size = {
|
|
|
|
type = nullOr (intBetween 0 100);
|
|
|
|
default = null;
|
|
|
|
description = "size of the left section of Navbuddy UI in percentage (0-100)";
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
|
|
|
border = mkOption {
|
2024-09-13 16:34:21 +00:00
|
|
|
type = borderType;
|
2024-03-10 18:37:49 +00:00
|
|
|
default = config.vim.ui.borders.globalStyle;
|
|
|
|
description = "border style to use for the middle section of Navbuddy UI";
|
|
|
|
};
|
2023-07-20 15:34:36 +00:00
|
|
|
};
|
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
# right section
|
|
|
|
# there is no size option for the right section, it fills the remaining space
|
|
|
|
right = {
|
|
|
|
border = mkOption {
|
2024-09-13 16:34:21 +00:00
|
|
|
type = borderType;
|
2024-03-10 18:37:49 +00:00
|
|
|
default = config.vim.ui.borders.globalStyle;
|
|
|
|
description = "border style to use for the right section of Navbuddy UI";
|
|
|
|
};
|
|
|
|
|
|
|
|
preview = mkOption {
|
|
|
|
type = enum ["leaf" "always" "never"];
|
|
|
|
default = "leaf";
|
|
|
|
description = "display mode of the preview on the right section";
|
|
|
|
};
|
2023-07-20 15:34:36 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
node_markers = {
|
|
|
|
enable = mkEnableOption "node markers";
|
|
|
|
icons = {
|
2024-03-10 18:40:33 +00:00
|
|
|
leaf = mkSimpleIconOption " ";
|
|
|
|
leaf_selected = mkSimpleIconOption " → ";
|
|
|
|
branch = mkSimpleIconOption " ";
|
2023-07-20 15:34:36 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
lsp = {
|
|
|
|
auto_attach = mkOption {
|
|
|
|
type = bool;
|
|
|
|
default = true;
|
|
|
|
description = "Whether to attach to LSP server manually";
|
|
|
|
};
|
2023-07-20 15:34:36 +00:00
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
preference = mkOption {
|
|
|
|
type = nullOr (listOf str);
|
|
|
|
default = null;
|
|
|
|
description = "list of lsp server names in order of preference";
|
|
|
|
};
|
2023-07-20 15:34:36 +00:00
|
|
|
};
|
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
source_buffer = {
|
|
|
|
followNode = mkOption {
|
|
|
|
type = bool;
|
|
|
|
default = true;
|
|
|
|
description = "keep the current node in focus on the source buffer";
|
|
|
|
};
|
2023-07-20 15:34:36 +00:00
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
highlight = mkOption {
|
|
|
|
type = bool;
|
|
|
|
default = true;
|
|
|
|
description = "highlight the currently focused node";
|
|
|
|
};
|
2023-07-20 15:34:36 +00:00
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
reorient = mkOption {
|
|
|
|
type = enum ["smart" "top" "mid" "none"];
|
|
|
|
default = "smart";
|
|
|
|
description = "reorient buffer after changing nodes";
|
|
|
|
};
|
2023-07-20 15:34:36 +00:00
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
scrolloff = mkOption {
|
|
|
|
type = nullOr int;
|
|
|
|
default = null;
|
|
|
|
description = "scrolloff value when navbuddy is open";
|
|
|
|
};
|
2023-07-20 15:34:36 +00:00
|
|
|
};
|
|
|
|
|
2024-03-10 18:37:49 +00:00
|
|
|
icons = {
|
2024-03-10 18:40:33 +00:00
|
|
|
File = mkSimpleIconOption " ";
|
|
|
|
Module = mkSimpleIconOption " ";
|
|
|
|
Namespace = mkSimpleIconOption " ";
|
|
|
|
Package = mkSimpleIconOption " ";
|
|
|
|
Class = mkSimpleIconOption " ";
|
|
|
|
Property = mkSimpleIconOption " ";
|
|
|
|
Field = mkSimpleIconOption " ";
|
|
|
|
Constructor = mkSimpleIconOption " ";
|
|
|
|
Enum = mkSimpleIconOption "";
|
|
|
|
Interface = mkSimpleIconOption "";
|
|
|
|
Function = mkSimpleIconOption " ";
|
|
|
|
Variable = mkSimpleIconOption " ";
|
|
|
|
Constant = mkSimpleIconOption " ";
|
|
|
|
String = mkSimpleIconOption " ";
|
|
|
|
Number = mkSimpleIconOption " ";
|
|
|
|
Boolean = mkSimpleIconOption "◩ ";
|
|
|
|
Array = mkSimpleIconOption " ";
|
|
|
|
Object = mkSimpleIconOption " ";
|
|
|
|
Method = mkSimpleIconOption " ";
|
|
|
|
Key = mkSimpleIconOption " ";
|
|
|
|
Null = mkSimpleIconOption " ";
|
|
|
|
EnumMember = mkSimpleIconOption " ";
|
|
|
|
Struct = mkSimpleIconOption " ";
|
|
|
|
Event = mkSimpleIconOption " ";
|
|
|
|
Operator = mkSimpleIconOption " ";
|
|
|
|
TypeParameter = mkSimpleIconOption " ";
|
2023-07-24 18:36:01 +00:00
|
|
|
};
|
|
|
|
};
|
2023-07-20 15:34:36 +00:00
|
|
|
};
|
2023-07-19 19:49:06 +00:00
|
|
|
};
|
|
|
|
}
|