plugins/magma-nvim: switch to settings option

This commit is contained in:
Gaetan Lepage 2024-03-02 19:11:05 +01:00 committed by Gaétan Lepage
parent 4d8285ac0c
commit 51765fedbe
2 changed files with 68 additions and 87 deletions

View file

@ -12,97 +12,76 @@ with helpers.vim-plugin;
originalName = "magma-nvim"; originalName = "magma-nvim";
defaultPackage = pkgs.vimPlugins.magma-nvim-goose; defaultPackage = pkgs.vimPlugins.magma-nvim-goose;
globalPrefix = "magma_"; globalPrefix = "magma_";
deprecateExtraConfig = true;
options = { # TODO introduced 2024-03-02: remove 2024-05-02
imageProvider = mkDefaultOpt { deprecateExtraConfig = true;
global = "image_provider"; optionsRenamedToSettings = [
description = '' "imageProvider"
"automaticallyOpenOutput"
"wrapOutput"
"outputWindowBorders"
"cellHighlightGroup"
"savePath"
"showMimetypeDebug"
];
settingsOptions = {
image_provider = helpers.defaultNullOpts.mkEnumFirstDefault ["none" "ueberzug" "kitty"] ''
This configures how to display images. The following options are available: This configures how to display images. The following options are available:
- "none" -- don't show images. - "none" -- don't show images.
- "ueberzug" -- use Ueberzug to display images. - "ueberzug" -- use Ueberzug to display images.
- "kitty" -- use the Kitty protocol to display images. - "kitty" -- use the Kitty protocol to display images.
Default: "none"
''; '';
type = types.enum ["none" "ueberzug" "kitty"];
};
automaticallyOpenOutput = mkDefaultOpt { automatically_open_output = helpers.defaultNullOpts.mkBool true ''
global = "automatically_open_output";
description = ''
If this is true, then whenever you have an active cell its output window will be If this is true, then whenever you have an active cell its output window will be
automatically shown. automatically shown.
If this is false, then the output window will only be automatically shown when you've just If this is false, then the output window will only be automatically shown when you've just
evaluated the code. evaluated the code.
So, if you take your cursor out of the cell, and then come back, the output window won't So, if you take your cursor out of the cell, and then come back, the output window won't be
be opened (but the cell will be highlighted). opened (but the cell will be highlighted).
This means that there will be nothing covering your code. This means that there will be nothing covering your code.
You can then open the output window at will using `:MagmaShowOutput`. You can then open the output window at will using `:MagmaShowOutput`.
Default: true
''; '';
type = types.bool;
example = false;
};
wrapOutput = mkDefaultOpt { wrap_output = helpers.defaultNullOpts.mkBool true ''
global = "wrap_output"; If this is true, then text output in the output window will be wrapped (akin to `set wrap`).
type = types.bool;
example = false;
description = ''
If this is true, then text output in the output window will be wrapped
(akin to `set wrap`).
Default: true
''; '';
};
outputWindowBorders = mkDefaultOpt { output_window_borders = helpers.defaultNullOpts.mkBool true ''
global = "output_window_borders";
type = types.bool;
example = false;
description = ''
If this is true, then the output window will have rounded borders. If this is true, then the output window will have rounded borders.
If it is false, it will have no borders. If it is false, it will have no borders.
Default: true
''; '';
};
cellHighlightGroup = mkDefaultOpt { cell_highlight_group = helpers.defaultNullOpts.mkStr "CursorLine" ''
global = "cell_highlight_group";
type = types.str;
description = ''
The highlight group to be used for highlighting cells. The highlight group to be used for highlighting cells.
Default: "CursorLine"
''; '';
};
savePath = mkDefaultOpt { save_path =
global = "save_path"; helpers.defaultNullOpts.mkStr
type = types.str; ''{__raw = "vim.fn.stdpath('data') .. '/magma'";}''
description = '' ''
Where to save/load with :MagmaSave and :MagmaLoad (with no parameters). Where to save/load with `:MagmaSave` and `:MagmaLoad` (with no parameters).
The generated file is placed in this directory, with the filename itself being the The generated file is placed in this directory, with the filename itself being the
buffer's name, with % replaced by %% and / replaced by %, and postfixed with the extension buffer's name, with `%` replaced by `%%` and `/` replaced by `%`, and postfixed with the
.json. extension `.json`.
''; '';
};
showMimetypeDebug = mkDefaultOpt { show_mimetype_debug = helpers.defaultNullOpts.mkBool false ''
global = "show_mimetype_debug";
type = types.bool;
example = true;
description = ''
If this is true, then before any non-iostream output chunk, Magma shows the mimetypes it If this is true, then before any non-iostream output chunk, Magma shows the mimetypes it
received for it. received for it.
This is meant for debugging and adding new mimetypes. This is meant for debugging and adding new mimetypes.
Default: false
''; '';
}; };
settingsExample = {
image_provider = "none";
automatically_open_output = true;
wrap_output = true;
output_window_borders = true;
cell_highlight_group = "CursorLine";
save_path.__raw = "vim.fn.stdpath('data') .. '/magma'";
show_mimetype_debug = false;
}; };
} }

View file

@ -7,13 +7,15 @@
plugins.magma-nvim = { plugins.magma-nvim = {
enable = true; enable = true;
imageProvider = "none"; settings = {
automaticallyOpenOutput = true; image_provider = "none";
wrapOutput = true; automatically_open_output = true;
outputWindowBorders = true; wrap_output = true;
cellHighlightGroup = "CursorLine"; output_window_borders = true;
savePath = null; cell_highlight_group = "CursorLine";
showMimetypeDebug = false; save_path.__raw = "vim.fn.stdpath('data') .. '/magma'";
show_mimetype_debug = false;
};
}; };
}; };
} }