mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
We used to only think of it as the plugin repo's name, but we have been needing to use it for the name of the plugin's packpath location.
122 lines
3.7 KiB
Nix
122 lines
3.7 KiB
Nix
{ lib, config, ... }:
|
|
let
|
|
inherit (lib.nixvim) defaultNullOpts;
|
|
inherit (lib) types;
|
|
in
|
|
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
|
name = "notebook-navigator";
|
|
packPathName = "NotebookNavigator-nvim";
|
|
package = "NotebookNavigator-nvim";
|
|
|
|
maintainers = [ lib.maintainers.GaetanLepage ];
|
|
|
|
settingsOptions = {
|
|
cell_markers = defaultNullOpts.mkAttrsOf' {
|
|
type = types.str;
|
|
pluginDefault = { };
|
|
example = {
|
|
python = "# %%";
|
|
};
|
|
description = ''
|
|
Code cell marker.
|
|
|
|
Cells start with the marker and end either at the beginning of the next cell or at the end of
|
|
the file.
|
|
|
|
By default, uses language-specific double percent comments like `# %%`.
|
|
This can be overridden for each language with this setting.
|
|
'';
|
|
};
|
|
|
|
activate_hydra_keys = defaultNullOpts.mkStr null ''
|
|
If not `nil` the keymap defined in the string will activate the hydra head.
|
|
If you don't want to use hydra you don't need to install it either.
|
|
'';
|
|
|
|
show_hydra_hint = defaultNullOpts.mkBool true ''
|
|
If `true` a hint panel will be shown when the hydra head is active.
|
|
If `false` you get a minimalistic hint on the command line.
|
|
'';
|
|
|
|
hydra_keys =
|
|
defaultNullOpts.mkAttrsOf types.str
|
|
{
|
|
comment = "c";
|
|
run = "X";
|
|
run_and_move = "x";
|
|
move_up = "k";
|
|
move_down = "j";
|
|
add_cell_before = "a";
|
|
add_cell_after = "b";
|
|
split_cell = "s";
|
|
}
|
|
''
|
|
Mappings while the hydra head is active.
|
|
'';
|
|
|
|
repl_provider =
|
|
defaultNullOpts.mkEnumFirstDefault
|
|
[
|
|
"auto"
|
|
"iron"
|
|
"molten"
|
|
"toggleterm"
|
|
]
|
|
''
|
|
The repl plugin with which to interface.
|
|
|
|
Current options:
|
|
- "iron" for iron.nvim,
|
|
- "toggleterm" for toggleterm.nvim,
|
|
- "molten" for molten-nvim
|
|
- "auto" which checks which of the above are installed
|
|
'';
|
|
|
|
syntax_highlight = defaultNullOpts.mkBool false ''
|
|
Syntax based highlighting.
|
|
|
|
If you don't want to install `mini.hipattners` or enjoy a more minimalistic look.
|
|
'';
|
|
|
|
cell_highlight_group = defaultNullOpts.mkStr "Folded" ''
|
|
For use with `mini.hipatterns` to highlight cell markers.
|
|
'';
|
|
};
|
|
|
|
# Optionally, provide an example for the `settings` option.
|
|
settingsExample = {
|
|
cell_markers.python = "# %%";
|
|
activate_hydra_keys = "<leader>h";
|
|
hydra_keys = {
|
|
comment = "c";
|
|
run = "X";
|
|
run_and_move = "x";
|
|
move_up = "k";
|
|
move_down = "j";
|
|
add_cell_before = "a";
|
|
add_cell_after = "b";
|
|
split_cell = "s";
|
|
};
|
|
repl_provider = "molten";
|
|
syntax_highlight = true;
|
|
cell_highlight_group = "Folded";
|
|
};
|
|
|
|
extraConfig = cfg: {
|
|
warnings =
|
|
(lib.optional ((cfg.settings.activate_hydra_keys != null) && (!config.plugins.hydra.enable)) ''
|
|
Nixvim (plugins.notebook-navigator): `plugins.notebook-navigator.settings.activate_hydra_keys` has been set to a non-`null`
|
|
value but `plugins.hydra.enable` is `false`.
|
|
'')
|
|
++
|
|
(lib.optional ((cfg.settings.repl_provider == "toggleterm") && (!config.plugins.toggleterm.enable)))
|
|
''
|
|
Nixvim (plugins.notebook-navigator): `plugins.notebook-navigator.settings.repl_provider` has been set to "toggleterm"
|
|
but `plugins.hydra.toggleterm.enable` is `false`.
|
|
''
|
|
++ (lib.optional ((cfg.settings.repl_provider == "molten") && (!config.plugins.molten.enable))) ''
|
|
Nixvim (plugins.notebook-navigator): `plugins.notebook-navigator.settings.repl_provider` has been set to "molten"
|
|
but `plugins.molten.enable` is `false`.
|
|
'';
|
|
};
|
|
}
|