mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-27 11:08:53 +02:00
plugins: remove mkCompositeOptions from implementation
This commit is contained in:
parent
70b4e2d981
commit
d8cffe2ead
13 changed files with 607 additions and 681 deletions
|
@ -16,7 +16,7 @@ in {
|
|||
|
||||
package = helpers.mkPackageOption "fidget" pkgs.vimPlugins.fidget-nvim;
|
||||
|
||||
text = helpers.mkCompositeOption "Fidget text options." {
|
||||
text = {
|
||||
spinner =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(types.either
|
||||
|
@ -75,7 +75,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
align = helpers.mkCompositeOption "Fidget alignment options." {
|
||||
align = {
|
||||
bottom = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to align fidgets along the bottom edge of each buffer.
|
||||
'';
|
||||
|
@ -88,7 +88,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
timer = helpers.mkCompositeOption "Fidget timing options." {
|
||||
timer = {
|
||||
spinnerRate = helpers.defaultNullOpts.mkNum 125 ''
|
||||
Duration of each frame of the spinner animation, in ms. Set to
|
||||
`0` to only use the first frame of the spinner animation.
|
||||
|
@ -109,7 +109,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
window = helpers.mkCompositeOption "Windowing rules options." {
|
||||
window = {
|
||||
relative = helpers.defaultNullOpts.mkEnum ["win" "editor"] "win" ''
|
||||
Whether to position the window relative to the current window,
|
||||
or the editor. Valid values are `"win"` or `"editor"`.
|
||||
|
@ -129,7 +129,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
fmt = helpers.mkCompositeOption "Fidget formatting options." {
|
||||
fmt = {
|
||||
leftpad = helpers.defaultNullOpts.mkBool true ''
|
||||
Whether to right-justify the text in a fidget box by left-padding
|
||||
it with spaces. Recommended when `align.right` is `true`.
|
||||
|
@ -194,7 +194,7 @@ in {
|
|||
List of options for fidget sources.
|
||||
'';
|
||||
|
||||
debug = helpers.mkCompositeOption "Fidget debugging options." {
|
||||
debug = {
|
||||
logging = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to enable logging, for debugging. The log is written to
|
||||
`~/.local/share/nvim/fidget.nvim.log`.
|
||||
|
@ -216,12 +216,12 @@ in {
|
|||
setupOptions =
|
||||
{
|
||||
inherit (cfg) text align window sources;
|
||||
timer = helpers.ifNonNull' cfg.timer {
|
||||
timer = {
|
||||
spinner_rate = cfg.timer.spinnerRate;
|
||||
fidget_decay = cfg.timer.fidgetDecay;
|
||||
task_decay = cfg.timer.taskDecay;
|
||||
};
|
||||
fmt = helpers.ifNonNull' cfg.fmt {
|
||||
fmt = {
|
||||
inherit (cfg.fmt) leftpad fidget task;
|
||||
stack_upwards = cfg.fmt.stackUpwards;
|
||||
max_width = cfg.fmt.maxWidth;
|
||||
|
|
|
@ -23,14 +23,14 @@ in {
|
|||
};
|
||||
|
||||
plugins = {
|
||||
autopep8 = helpers.mkCompositeOption "autopep8 settings" {
|
||||
autopep8 = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable or disable the plugin.
|
||||
Setting this explicitely to `true` will install the dependency for this plugin (autopep8).
|
||||
'';
|
||||
};
|
||||
|
||||
flake8 = helpers.mkCompositeOption "flake8 settings" {
|
||||
flake8 = {
|
||||
config = helpers.mkNullOrOption types.str ''
|
||||
Path to the config file that will be the authoritative config source.
|
||||
'';
|
||||
|
@ -84,7 +84,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
jedi = helpers.mkCompositeOption "jedi settings" {
|
||||
jedi = {
|
||||
auto_import_modules =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(types.listOf types.str)
|
||||
|
@ -100,7 +100,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
jedi_completion = helpers.mkCompositeOption "jedi_completion settings" {
|
||||
jedi_completion = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||
|
||||
include_params = helpers.defaultNullOpts.mkBool true ''
|
||||
|
@ -134,7 +134,7 @@ in {
|
|||
"Modules for which labels and snippets should be cached.";
|
||||
};
|
||||
|
||||
jedi_definition = helpers.mkCompositeOption "jedi_definition settings" {
|
||||
jedi_definition = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||
|
||||
follow_imports = helpers.defaultNullOpts.mkBool true ''
|
||||
|
@ -150,19 +150,19 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
jedi_hover = helpers.mkCompositeOption "jedi_hover settings" {
|
||||
jedi_hover = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||
};
|
||||
|
||||
jedi_references = helpers.mkCompositeOption "jedi_references settings" {
|
||||
jedi_references = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||
};
|
||||
|
||||
jedi_signature_help = helpers.mkCompositeOption "jedi_signature_help settings" {
|
||||
jedi_signature_help = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||
};
|
||||
|
||||
jedi_symbols = helpers.mkCompositeOption "jedi_symbols settings" {
|
||||
jedi_symbols = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||
|
||||
all_scopes = helpers.defaultNullOpts.mkBool true ''
|
||||
|
@ -174,7 +174,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
mccabe = helpers.mkCompositeOption "mccabe settings" {
|
||||
mccabe = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable or disable the plugin.
|
||||
Setting this explicitely to `true` will install the dependency for this plugin (mccabe).
|
||||
|
@ -185,7 +185,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
preload = helpers.mkCompositeOption "preload settings" {
|
||||
preload = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
|
||||
|
||||
modules = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
|
||||
|
@ -193,7 +193,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
pycodestyle = helpers.mkCompositeOption "pycodestyle settings" {
|
||||
pycodestyle = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable or disable the plugin.
|
||||
Setting this explicitely to `true` will install the dependency for this plugin
|
||||
|
@ -229,7 +229,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
pydocstyle = helpers.mkCompositeOption "pydocstyle settings" {
|
||||
pydocstyle = {
|
||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable or disable the plugin.
|
||||
Setting this explicitely to `true` will install the dependency for this plugin
|
||||
|
@ -273,14 +273,14 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
pyflakes = helpers.mkCompositeOption "pyflakes settings" {
|
||||
pyflakes = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable or disable the plugin.
|
||||
Setting this explicitely to `true` will install the dependency for this plugin (pyflakes).
|
||||
'';
|
||||
};
|
||||
|
||||
pylint = helpers.mkCompositeOption "pylint settings" {
|
||||
pylint = {
|
||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable or disable the plugin.
|
||||
Setting this explicitely to `true` will install the dependency for this plugin (pylint).
|
||||
|
@ -297,7 +297,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
rope_autoimport = helpers.mkCompositeOption "rope_autoimport settings" {
|
||||
rope_autoimport = {
|
||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable or disable the plugin.
|
||||
Setting this explicitely to `true` will install the dependency for this plugin (rope).
|
||||
|
@ -309,7 +309,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
rope_completion = helpers.mkCompositeOption "rope_completion settings" {
|
||||
rope_completion = {
|
||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable or disable the plugin.
|
||||
Setting this explicitely to `true` will install the dependency for this plugin (rope).
|
||||
|
@ -320,7 +320,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
yapf = helpers.mkCompositeOption "yapf settings" {
|
||||
yapf = {
|
||||
enabled = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable or disable the plugin.
|
||||
Setting this explicitely to `true` will install the dependency for this plugin (yapf).
|
||||
|
@ -328,7 +328,7 @@ in {
|
|||
};
|
||||
|
||||
### THIRD-PARTY PLUGINS
|
||||
pylsp_mypy = helpers.mkCompositeOption "pylsp_mypy settings" {
|
||||
pylsp_mypy = {
|
||||
enabled = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable or disable the plugin.
|
||||
Setting this explicitely to `true` will install the dependency for this plugin
|
||||
|
@ -484,7 +484,7 @@ in {
|
|||
### END OF THIRD-PARTY PLUGINS
|
||||
};
|
||||
|
||||
rope = helpers.mkCompositeOption "rope settings" {
|
||||
rope = {
|
||||
extensionModules = helpers.mkNullOrOption types.str ''
|
||||
Builtin and c-extension modules that are allowed to be imported and inspected by rope.
|
||||
'';
|
||||
|
@ -504,7 +504,7 @@ in {
|
|||
# plugins to its `propagatedBuildInputs`.
|
||||
# See https://github.com/NixOS/nixpkgs/issues/229337
|
||||
plugins.lsp.servers.pylsp.package = let
|
||||
isEnabled = x: (x != null) && (x.enabled != null && x.enabled);
|
||||
isEnabled = x: (x.enabled != null && x.enabled);
|
||||
inherit (cfg.settings) plugins;
|
||||
|
||||
nativePlugins =
|
||||
|
|
|
@ -48,90 +48,84 @@ in
|
|||
padding = helpers.defaultNullOpts.mkBool true "Add an extra new line on top of the list";
|
||||
|
||||
actionKeys =
|
||||
helpers.mkCompositeOption
|
||||
''
|
||||
Key mappings for actions in the trouble list.
|
||||
Map to `{}` to remove a mapping, for example:
|
||||
`close = {};`
|
||||
''
|
||||
(mapAttrs
|
||||
(
|
||||
action: config:
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; either str (listOf str))
|
||||
config.default
|
||||
config.description
|
||||
)
|
||||
{
|
||||
close = {
|
||||
default = "q";
|
||||
description = "Close the list";
|
||||
};
|
||||
cancel = {
|
||||
default = "<esc>";
|
||||
description = "Cancel the preview and get back to your last window / buffer / cursor";
|
||||
};
|
||||
refresh = {
|
||||
default = "r";
|
||||
description = "Manually refresh";
|
||||
};
|
||||
jump = {
|
||||
default = "[ \"<cr>\" \"<tab>\" ]";
|
||||
description = "Jump to the diagnostic or open / close folds";
|
||||
};
|
||||
openSplit = {
|
||||
default = "[ \"<c-x>\" ]";
|
||||
description = "Open buffer in new split";
|
||||
};
|
||||
openVsplit = {
|
||||
default = "[ \"<c-v>\" ]";
|
||||
description = "Open buffer in new vsplit";
|
||||
};
|
||||
openTab = {
|
||||
default = "[ \"<c-t>\" ]";
|
||||
description = "Open buffer in new tab";
|
||||
};
|
||||
jumpClose = {
|
||||
default = "[ \"o\" ]";
|
||||
description = "Jump to the diagnostic and close the list";
|
||||
};
|
||||
toggleMode = {
|
||||
default = "m";
|
||||
description = "toggle between 'workspace' and 'document' diagnostics mode";
|
||||
};
|
||||
togglePreview = {
|
||||
default = "P";
|
||||
description = "Toggle auto_preview";
|
||||
};
|
||||
hover = {
|
||||
default = "K";
|
||||
description = "Opens a small popup with the full multiline message";
|
||||
};
|
||||
preview = {
|
||||
default = "p";
|
||||
description = "Preview the diagnostic location";
|
||||
};
|
||||
closeFolds = {
|
||||
default = "[ \"zM\" \"zm\" ]";
|
||||
description = "Close all folds";
|
||||
};
|
||||
openFolds = {
|
||||
default = "[ \"zR\" \"zr\" ]";
|
||||
description = "Open all folds";
|
||||
};
|
||||
toggleFold = {
|
||||
default = "[ \"zA\" \"za\" ]";
|
||||
description = "Toggle fold of current file";
|
||||
};
|
||||
previous = {
|
||||
default = "k";
|
||||
description = "Previous item";
|
||||
};
|
||||
next = {
|
||||
default = "j";
|
||||
description = "Next item";
|
||||
};
|
||||
});
|
||||
mapAttrs
|
||||
(
|
||||
action: config:
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(with types; either str (listOf str))
|
||||
config.default
|
||||
config.description
|
||||
)
|
||||
{
|
||||
close = {
|
||||
default = "q";
|
||||
description = "Close the list";
|
||||
};
|
||||
cancel = {
|
||||
default = "<esc>";
|
||||
description = "Cancel the preview and get back to your last window / buffer / cursor";
|
||||
};
|
||||
refresh = {
|
||||
default = "r";
|
||||
description = "Manually refresh";
|
||||
};
|
||||
jump = {
|
||||
default = "[ \"<cr>\" \"<tab>\" ]";
|
||||
description = "Jump to the diagnostic or open / close folds";
|
||||
};
|
||||
openSplit = {
|
||||
default = "[ \"<c-x>\" ]";
|
||||
description = "Open buffer in new split";
|
||||
};
|
||||
openVsplit = {
|
||||
default = "[ \"<c-v>\" ]";
|
||||
description = "Open buffer in new vsplit";
|
||||
};
|
||||
openTab = {
|
||||
default = "[ \"<c-t>\" ]";
|
||||
description = "Open buffer in new tab";
|
||||
};
|
||||
jumpClose = {
|
||||
default = "[ \"o\" ]";
|
||||
description = "Jump to the diagnostic and close the list";
|
||||
};
|
||||
toggleMode = {
|
||||
default = "m";
|
||||
description = "toggle between 'workspace' and 'document' diagnostics mode";
|
||||
};
|
||||
togglePreview = {
|
||||
default = "P";
|
||||
description = "Toggle auto_preview";
|
||||
};
|
||||
hover = {
|
||||
default = "K";
|
||||
description = "Opens a small popup with the full multiline message";
|
||||
};
|
||||
preview = {
|
||||
default = "p";
|
||||
description = "Preview the diagnostic location";
|
||||
};
|
||||
closeFolds = {
|
||||
default = "[ \"zM\" \"zm\" ]";
|
||||
description = "Close all folds";
|
||||
};
|
||||
openFolds = {
|
||||
default = "[ \"zR\" \"zr\" ]";
|
||||
description = "Open all folds";
|
||||
};
|
||||
toggleFold = {
|
||||
default = "[ \"zA\" \"za\" ]";
|
||||
description = "Toggle fold of current file";
|
||||
};
|
||||
previous = {
|
||||
default = "k";
|
||||
description = "Previous item";
|
||||
};
|
||||
next = {
|
||||
default = "j";
|
||||
description = "Next item";
|
||||
};
|
||||
};
|
||||
|
||||
indentLines = helpers.defaultNullOpts.mkBool true ''
|
||||
Add an indent guide below the fold icons.
|
||||
|
@ -161,21 +155,18 @@ in
|
|||
"For the given modes, automatically jump if there is only a single result.";
|
||||
|
||||
signs =
|
||||
helpers.mkCompositeOption "Incons/text used for the different diagnostics."
|
||||
mapAttrs
|
||||
(
|
||||
mapAttrs
|
||||
(
|
||||
diagnostic: default:
|
||||
helpers.defaultNullOpts.mkStr default "Icon/text for ${diagnostic} diagnostics."
|
||||
)
|
||||
{
|
||||
error = "";
|
||||
warning = "";
|
||||
hint = "";
|
||||
information = "";
|
||||
other = "";
|
||||
}
|
||||
);
|
||||
diagnostic: default:
|
||||
helpers.defaultNullOpts.mkStr default "Icon/text for ${diagnostic} diagnostics."
|
||||
)
|
||||
{
|
||||
error = "";
|
||||
warning = "";
|
||||
hint = "";
|
||||
information = "";
|
||||
other = "";
|
||||
};
|
||||
|
||||
useDiagnosticSigns = helpers.defaultNullOpts.mkBool false ''
|
||||
Enabling this will use the signs defined in your lsp client
|
||||
|
@ -197,22 +188,6 @@ in
|
|||
fold_open = cfg.foldOpen;
|
||||
fold_closed = cfg.foldClosed;
|
||||
inherit (cfg) group padding;
|
||||
action_keys =
|
||||
helpers.ifNonNull' cfg.actionKeys
|
||||
(with cfg.actionKeys; {
|
||||
inherit close cancel refresh jump;
|
||||
open_split = openSplit;
|
||||
open_vsplit = openVsplit;
|
||||
open_tab = openTab;
|
||||
jump_close = jumpClose;
|
||||
toggle_mode = toggleMode;
|
||||
toggle_preview = togglePreview;
|
||||
inherit hover preview;
|
||||
close_folds = closeFolds;
|
||||
open_folds = openFolds;
|
||||
toggle_fold = toggleFold;
|
||||
inherit next;
|
||||
});
|
||||
indent_lines = cfg.indentLines;
|
||||
auto_open = cfg.autoOpen;
|
||||
auto_close = cfg.autoClose;
|
||||
|
@ -220,6 +195,23 @@ in
|
|||
auto_fold = cfg.autoFold;
|
||||
auto_jump = cfg.autoJump;
|
||||
inherit (cfg) signs;
|
||||
action_keys = with cfg.actionKeys; {
|
||||
inherit close cancel refresh jump;
|
||||
open_split = openSplit;
|
||||
open_vsplit = openVsplit;
|
||||
open_tab = openTab;
|
||||
jump_close = jumpClose;
|
||||
toggle_mode = toggleMode;
|
||||
toggle_preview = togglePreview;
|
||||
inherit
|
||||
hover
|
||||
preview
|
||||
;
|
||||
close_folds = closeFolds;
|
||||
open_folds = openFolds;
|
||||
toggle_fold = toggleFold;
|
||||
inherit next;
|
||||
};
|
||||
use_diagnostic_signs = cfg.useDiagnosticSigns;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue