plugins/utils: normalize plugin defaults

This commit is contained in:
Matt Sturgeon 2024-06-11 16:54:57 +01:00
parent b10a391bd0
commit 6ab2a39e6a
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
53 changed files with 1434 additions and 1221 deletions

View file

@ -229,7 +229,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
}
)
)
"[]"
[ ]
''
A list of vault names and paths.
Each path should be the path to the vault root.

View file

@ -32,7 +32,7 @@ with lib;
substitutions = helpers.defaultNullOpts.mkAttrsOf (
with helpers.nixvimTypes; either str rawLua
) "{}" "A map for custom variables, the key should be the variable and the value a function.";
) { } "A map for custom variables, the key should be the variable and the value a function.";
};
new_notes_location =
@ -203,11 +203,14 @@ with lib;
'';
completion = {
nvim_cmp = helpers.mkNullOrOption types.bool ''
Set to false to disable completion.
Default: `true` if `nvim-cmp` is enabled (`plugins.cmp.enable`).
'';
# FIXME should this accept raw types?
nvim_cmp = helpers.mkNullOrOption' {
type = types.bool;
description = ''
Set to false to disable completion.
'';
defaultText = literalMD "`true` if `plugins.cmp.enable` is enabled (otherwise `null`).";
};
min_chars = helpers.defaultNullOpts.mkUnsignedInt 2 ''
Trigger completion at this many chars.
@ -233,23 +236,21 @@ with lib;
};
})
)
''
{
gf = {
action = "require('obsidian').util.gf_passthrough";
opts = {
noremap = false;
expr = true;
buffer = true;
};
{
gf = {
action = "require('obsidian').util.gf_passthrough";
opts = {
noremap = false;
expr = true;
buffer = true;
};
};
"<leader>ch" = {
action = "require('obsidian').util.toggle_checkbox";
opts.buffer = true;
};
}
''
"<leader>ch" = {
action = "require('obsidian').util.toggle_checkbox";
opts.buffer = true;
};
}
''
Configure key mappings.
'';
@ -268,12 +269,10 @@ with lib;
note_mappings =
helpers.defaultNullOpts.mkAttrsOf types.str
''
{
new = "<C-x>";
insert_link = "<C-l>";
}
''
{
new = "<C-x>";
insert_link = "<C-l>";
}
''
Optional, configure note mappings for the picker. These are the defaults.
Not all pickers support all mappings.
@ -281,12 +280,10 @@ with lib;
tag_mappings =
helpers.defaultNullOpts.mkAttrsOf types.str
''
{
tag_note = "<C-x>";
insert_tag = "<C-l>";
}
''
{
tag_note = "<C-x>";
insert_tag = "<C-l>";
}
''
Optional, configure tag mappings for the picker. These are the defaults.
Not all pickers support all mappings.
@ -369,10 +366,10 @@ with lib;
'';
checkboxes =
helpers.defaultNullOpts.mkNullable
helpers.defaultNullOpts.mkAttrsOf
(
with types;
attrsOf (submodule {
submodule {
options = {
char = mkOption {
type = with helpers.nixvimTypes; maybeRaw str;
@ -384,28 +381,26 @@ with lib;
description = "The name of the highlight group to use for this checkbox.";
};
};
})
)
''
{
" " = {
char = "󰄱";
hl_group = "ObsidianTodo";
};
"x" = {
char = "";
hl_group = "ObsidianDone";
};
">" = {
char = "";
hl_group = "ObsidianRightArrow";
};
"~" = {
char = "󰰱";
hl_group = "ObsidianTilde";
};
}
''
)
{
" " = {
char = "󰄱";
hl_group = "ObsidianTodo";
};
"x" = {
char = "";
hl_group = "ObsidianDone";
};
">" = {
char = "";
hl_group = "ObsidianRightArrow";
};
"~" = {
char = "󰰱";
hl_group = "ObsidianTilde";
};
}
''
Define how various check-boxes are displayed.
You can also add more custom ones...
@ -452,40 +447,38 @@ with lib;
'';
};
hl_groups = helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; attrsOf highlight) ''
{
ObsidianTodo = {
bold = true;
fg = "#f78c6c";
};
ObsidianDone = {
bold = true;
fg = "#89ddff";
};
ObsidianRightArrow = {
bold = true;
fg = "#f78c6c";
};
ObsidianTilde = {
bold = true;
fg = "#ff5370";
};
ObsidianRefText = {
underline = true;
fg = "#c792ea";
};
ObsidianExtLinkIcon = {
fg = "#c792ea";
};
ObsidianTag = {
italic = true;
fg = "#89ddff";
};
ObsidianHighlightText = {
bg = "#75662e";
};
}
'' "Highlight group definitions.";
hl_groups = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight {
ObsidianTodo = {
bold = true;
fg = "#f78c6c";
};
ObsidianDone = {
bold = true;
fg = "#89ddff";
};
ObsidianRightArrow = {
bold = true;
fg = "#f78c6c";
};
ObsidianTilde = {
bold = true;
fg = "#ff5370";
};
ObsidianRefText = {
underline = true;
fg = "#c792ea";
};
ObsidianExtLinkIcon = {
fg = "#c792ea";
};
ObsidianTag = {
italic = true;
fg = "#89ddff";
};
ObsidianHighlightText = {
bg = "#75662e";
};
} "Highlight group definitions.";
};
attachments = {