nix-community.nixvim/plugins/by-name/julia-cell/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

96 lines
2.1 KiB
Nix
Raw Normal View History

2023-06-01 16:14:42 +02:00
{
lib,
helpers,
2023-06-01 16:14:42 +02:00
...
}:
let
# The keys are the option name in nixvim (under plugins.julia-cell.keymaps)
# cmd: Such that the mapping action is ':JuliaCell${cmd}<CR>'
# desc: The description of the option.
mappings = {
executeCell = {
cmd = "ExecuteCell";
desc = "executing the current code cell";
};
executeCellJump = {
cmd = "ExecuteCellJump";
desc = "executing the current code cell and jumping to the next cell";
};
run = {
cmd = "Run";
desc = "running the entire file";
};
clear = {
cmd = "Clear";
desc = "clearing the REPL";
};
prevCell = {
cmd = "PrevCell";
desc = "jumping to the previous cell header";
};
nextCell = {
cmd = "NextCell";
desc = "jumping to the next cell header";
};
};
in
with lib;
2024-12-22 09:58:27 +00:00
lib.nixvim.plugins.mkVimPlugin {
name = "julia-cell";
packPathName = "vim-julia-cell";
package = "vim-julia-cell";
globalPrefix = "julia_cell_";
2023-06-01 16:14:42 +02:00
maintainers = [ maintainers.GaetanLepage ];
2023-06-01 16:14:42 +02:00
# TODO introduced 2024-02-19: remove 2024-04-19
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"delimitCellsBy"
"tag"
];
2023-06-01 16:14:42 +02:00
settingsOptions = {
delimit_cells_by =
helpers.defaultNullOpts.mkEnumFirstDefault
[
"marks"
"tags"
]
''
Specifies if cells are delimited by 'marks' or 'tags'.
2023-06-01 16:14:42 +02:00
'';
tag = helpers.defaultNullOpts.mkStr "##" "Specifies the tag format.";
};
extraOptions = {
keymaps =
{
silent = mkOption {
type = types.bool;
description = "Whether julia-cell keymaps should be silent";
default = false;
};
}
// (mapAttrs (name: value: helpers.mkNullOrOption types.str "Keymap for ${value.desc}.") mappings);
2023-06-01 16:14:42 +02:00
};
extraConfig = cfg: {
keymaps = flatten (
mapAttrsToList (
name: value:
let
key = cfg.keymaps.${name};
in
optional (key != null) {
mode = "n";
inherit key;
action = ":JuliaCell${value.cmd}<CR>";
options.silent = cfg.keymaps.silent;
}
2023-06-01 16:14:42 +02:00
) mappings
);
};
}