mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-28 03:20:08 +02:00
plugins/molten: switch to settings option
This commit is contained in:
parent
0c1c11049c
commit
d8432ef9c1
2 changed files with 201 additions and 184 deletions
|
@ -12,201 +12,181 @@ with helpers.vim-plugin;
|
||||||
originalName = "molten-nvim";
|
originalName = "molten-nvim";
|
||||||
defaultPackage = pkgs.vimPlugins.molten-nvim;
|
defaultPackage = pkgs.vimPlugins.molten-nvim;
|
||||||
globalPrefix = "molten_";
|
globalPrefix = "molten_";
|
||||||
|
|
||||||
|
# TODO introduced 2024-03-01: remove 2024-05-01
|
||||||
deprecateExtraConfig = true;
|
deprecateExtraConfig = true;
|
||||||
|
optionsRenamedToSettings = [
|
||||||
|
"autoOpenOutput"
|
||||||
|
"copyOutput"
|
||||||
|
"enterOutputBehavior"
|
||||||
|
"imageProvider"
|
||||||
|
"outputCropBorder"
|
||||||
|
"outputShowMore"
|
||||||
|
"outputVirtLines"
|
||||||
|
"outputWinBorder"
|
||||||
|
"outputWinCoverGutter"
|
||||||
|
"outputWinHideOnLeave"
|
||||||
|
"outputWinMaxHeight"
|
||||||
|
"outputWinMaxWidth"
|
||||||
|
"outputWinStyle"
|
||||||
|
"savePath"
|
||||||
|
"useBorderHighlights"
|
||||||
|
"virtLinesOffBy1"
|
||||||
|
"wrapOutput"
|
||||||
|
"showMimetypeDebug"
|
||||||
|
];
|
||||||
|
|
||||||
options = {
|
settingsOptions = {
|
||||||
autoOpenOutput = mkDefaultOpt {
|
auto_image_popup = helpers.defaultNullOpts.mkBool false ''
|
||||||
global = "auto_open_output";
|
When true, cells that produce an image output will open the image output automatically with
|
||||||
description = ''
|
python's `Image.show()`.
|
||||||
Automatically open the output window when your cursor moves over a cell.
|
'';
|
||||||
|
|
||||||
Default: `true`
|
auto_init_behavior = helpers.defaultNullOpts.mkStr "init" ''
|
||||||
'';
|
When set to "raise" commands which would otherwise ask for a kernel when they're run without
|
||||||
type = types.bool;
|
a running kernel will instead raise an exception.
|
||||||
example = false;
|
Useful for other plugins that want to use `pcall` and do their own error handling.
|
||||||
};
|
'';
|
||||||
|
|
||||||
copyOutput = mkDefaultOpt {
|
auto_open_html_in_browser = helpers.defaultNullOpts.mkBool false ''
|
||||||
global = "copy_output";
|
Automatically open HTML outputs in a browser. related: `open_cmd`.
|
||||||
description = ''
|
'';
|
||||||
Copy evaluation output to clipboard automatically (requires pyperclip).
|
|
||||||
|
|
||||||
Default: `false`
|
auto_open_output = helpers.defaultNullOpts.mkBool true ''
|
||||||
'';
|
Automatically open the floating output window when your cursor moves into a cell.
|
||||||
type = types.bool;
|
'';
|
||||||
example = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
enterOutputBehavior = mkDefaultOpt {
|
cover_empty_lines = helpers.defaultNullOpts.mkBool false ''
|
||||||
global = "enter_output_behavior";
|
The output window and virtual text will be shown just below the last line of code in the
|
||||||
description = ''
|
cell.
|
||||||
The behavior of MoltenEnterOutput.
|
'';
|
||||||
|
|
||||||
Default: `"open_then_enter"`
|
cover_lines_starting_with = helpers.defaultNullOpts.mkListOf types.str "[]" ''
|
||||||
'';
|
When `cover_empty_lines` is `true`, also covers lines starting with these strings.
|
||||||
type = types.enum ["open_then_enter" "open_and_enter" "no_open"];
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
imageProvider = mkDefaultOpt {
|
copy_output = helpers.defaultNullOpts.mkBool false ''
|
||||||
global = "image_provider";
|
Copy evaluation output to clipboard automatically (requires `pyperclip`).
|
||||||
description = ''
|
'';
|
||||||
How images are displayed.
|
|
||||||
|
|
||||||
Default: `"none"`
|
enter_output_behavior =
|
||||||
'';
|
helpers.defaultNullOpts.mkEnumFirstDefault
|
||||||
type = types.enum ["none" "image.nvim"];
|
["open_then_enter" "open_and_enter" "no_open"]
|
||||||
};
|
"The behavior of [MoltenEnterOutput](https://github.com/benlubas/molten-nvim#moltenenteroutput).";
|
||||||
|
|
||||||
outputCropBorder = mkDefaultOpt {
|
image_provider = helpers.defaultNullOpts.mkEnumFirstDefault ["none" "image.nvim"] ''
|
||||||
global = "output_crop_border";
|
How images are displayed.
|
||||||
description = ''
|
'';
|
||||||
'crops' the bottom border of the output window when it would otherwise just sit at the
|
|
||||||
bottom of the screen.
|
|
||||||
|
|
||||||
Default: `true`
|
open_cmd = helpers.mkNullOrOption types.str ''
|
||||||
'';
|
Defaults to `xdg-open` on Linux, `open` on Darwin, and `start` on Windows.
|
||||||
type = types.bool;
|
But you can override it to whatever you want.
|
||||||
};
|
The command is called like: `subprocess.run([open_cmd, filepath])`
|
||||||
|
'';
|
||||||
|
|
||||||
outputShowMore = mkDefaultOpt {
|
output_crop_border = helpers.defaultNullOpts.mkBool true ''
|
||||||
global = "output_show_more";
|
'crops' the bottom border of the output window when it would otherwise just sit at the
|
||||||
description = ''
|
bottom of the screen.
|
||||||
When the window can't display the entire contents of the output buffer, shows the number
|
'';
|
||||||
of extra lines in the window footer (requires nvim 10.0+ and a window border).
|
|
||||||
|
|
||||||
Default: `false`
|
output_show_more = helpers.defaultNullOpts.mkBool false ''
|
||||||
'';
|
When the window can't display the entire contents of the output buffer, shows the number of
|
||||||
type = types.bool;
|
extra lines in the window footer (requires nvim 10.0+ and a window border).
|
||||||
};
|
'';
|
||||||
|
|
||||||
outputVirtLines = mkDefaultOpt {
|
output_virt_lines = helpers.defaultNullOpts.mkBool false ''
|
||||||
global = "output_virt_lines";
|
Pad the main buffer with virtual lines so the floating window doesn't cover anything while
|
||||||
description = ''
|
it's open.
|
||||||
Pad the main buffer with virtual lines so the output doesn't cover anything while it's
|
'';
|
||||||
open.
|
|
||||||
|
|
||||||
Default: `false`
|
output_win_border = helpers.defaultNullOpts.mkBorder ''["" "━" "" ""]'' "output window" "";
|
||||||
'';
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
|
|
||||||
outputWinBorder = mkDefaultOpt {
|
output_win_cover_gutter = helpers.defaultNullOpts.mkBool true ''
|
||||||
global = "output_win_border";
|
Should the output window cover the gutter (numbers and sign col), or not.
|
||||||
description = ''
|
If you change this, you probably also want to change `output_win_style`.
|
||||||
Some border features will not work if you don't specify your border as a table.
|
'';
|
||||||
See border option of `:h nvim_open_win()`.
|
|
||||||
|
|
||||||
Default: `["" "━" "" ""]`
|
output_win_hide_on_leave = helpers.defaultNullOpts.mkBool true ''
|
||||||
'';
|
After leaving the output window (via `:q` or switching windows), do not attempt to redraw
|
||||||
type = helpers.nixvimTypes.border;
|
the output window.
|
||||||
};
|
'';
|
||||||
|
|
||||||
outputWinCoverGutter = mkDefaultOpt {
|
output_win_max_height = helpers.defaultNullOpts.mkUnsignedInt 999999 ''
|
||||||
global = "output_win_cover_gutter";
|
Max height of the output window.
|
||||||
description = ''
|
'';
|
||||||
Should the output window cover the gutter (numbers and sign col), or not.
|
|
||||||
If you change this, you probably also want to change `outputWinStyle`.
|
|
||||||
|
|
||||||
Default: `true`
|
output_win_max_width = helpers.defaultNullOpts.mkUnsignedInt 999999 ''
|
||||||
'';
|
Max width of the output window.
|
||||||
type = types.bool;
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
outputWinHideOnLeave = mkDefaultOpt {
|
output_win_style = helpers.defaultNullOpts.mkEnum [false "minimal"] "false" ''
|
||||||
global = "output_win_hide_on_leave";
|
Value passed to the style option in `:h nvim_open_win()`.
|
||||||
description = ''
|
'';
|
||||||
After leaving the output window (via `:q` or switching windows), do not attempt to redraw
|
|
||||||
the output window.
|
|
||||||
|
|
||||||
Default: `true`
|
save_path =
|
||||||
'';
|
helpers.defaultNullOpts.mkStr
|
||||||
type = types.bool;
|
''{__raw = "vim.fn.stdpath('data')..'/molten'";}''
|
||||||
};
|
"Where to save/load data with `:MoltenSave` and `:MoltenLoad`.";
|
||||||
|
|
||||||
outputWinMaxHeight = mkDefaultOpt {
|
tick_rate = helpers.defaultNullOpts.mkUnsignedInt 500 ''
|
||||||
global = "output_win_max_height";
|
How often (in ms) we poll the kernel for updates.
|
||||||
description = ''
|
Determines how quickly the ui will update, if you want a snappier experience, you can set
|
||||||
Max height of the output window.
|
this to 150 or 200.
|
||||||
|
'';
|
||||||
|
|
||||||
Default: `999999`
|
use_border_highlights = helpers.defaultNullOpts.mkBool false ''
|
||||||
'';
|
When true, uses different highlights for output border depending on the state of the cell
|
||||||
type = types.ints.unsigned;
|
(running, done, error).
|
||||||
};
|
'';
|
||||||
|
|
||||||
outputWinMaxWidth = mkDefaultOpt {
|
limit_output_chars = helpers.defaultNullOpts.mkUnsignedInt 1000000 ''
|
||||||
global = "output_win_max_width";
|
Limit on the number of chars in an output.
|
||||||
description = ''
|
If you're lagging your editor with too much output text, decrease it.
|
||||||
Max width of the output window.
|
'';
|
||||||
|
|
||||||
Default: `999999`
|
virt_lines_off_by_1 = helpers.defaultNullOpts.mkBool false ''
|
||||||
'';
|
Allows the output window to cover exactly one line of the regular buffer when
|
||||||
type = types.ints.unsigned;
|
`output_virt_lines` is `true`, also effects where `virt_text_output` is displayed.
|
||||||
};
|
(useful for running code in a markdown file where that covered line will just be ```).
|
||||||
|
'';
|
||||||
|
|
||||||
outputWinStyle = mkDefaultOpt {
|
virt_text_output = helpers.defaultNullOpts.mkBool false ''
|
||||||
global = "output_win_style";
|
When true, show output as virtual text below the cell, virtual text stays after leaving the
|
||||||
description = ''
|
cell.
|
||||||
Value passed to the `style` option in `:h nvim_open_win()`
|
When true, output window doesn't open automatically on run.
|
||||||
|
Effected by `virt_lines_off_by_1`.
|
||||||
|
'';
|
||||||
|
|
||||||
Default: `false`
|
virt_text_max_lines = helpers.defaultNullOpts.mkUnsignedInt 12 ''
|
||||||
'';
|
Max height of the virtual text.
|
||||||
type = types.enum [false "minimal"];
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
savePath = mkDefaultOpt {
|
wrap_output = helpers.defaultNullOpts.mkBool false ''
|
||||||
global = "save_path";
|
Wrap output text.
|
||||||
description = ''
|
'';
|
||||||
Where to save/load data with `:MoltenSave` and `:MoltenLoad`.
|
|
||||||
|
|
||||||
Default: `{__raw = "vim.fn.stdpath('data')..'/molten'";}`
|
show_mimetype_debug = helpers.defaultNullOpts.mkBool false ''
|
||||||
'';
|
Before any non-iostream output chunk, the mime-type for that output chunk is shown.
|
||||||
type = with helpers.nixvimTypes; either str rawLua;
|
Meant for debugging/plugin devlopment.
|
||||||
};
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
useBorderHighlights = mkDefaultOpt {
|
settingsExample = {
|
||||||
global = "use_border_highlights";
|
auto_open_output = true;
|
||||||
description = ''
|
copy_output = false;
|
||||||
When true, uses different highlights for output border depending on the state of the cell
|
enter_output_behavior = "open_then_enter";
|
||||||
(running, done, error).
|
image_provider = "none";
|
||||||
See [highlights](https://github.com/benlubas/molten-nvim#highlights).
|
output_crop_border = true;
|
||||||
|
output_show_more = false;
|
||||||
Default: `false`
|
output_virt_lines = false;
|
||||||
'';
|
output_win_border = ["" "━" "" ""];
|
||||||
type = types.bool;
|
output_win_cover_gutter = true;
|
||||||
};
|
output_win_hide_on_leave = true;
|
||||||
|
output_win_style = false;
|
||||||
virtLinesOffBy1 = mkDefaultOpt {
|
save_path.__raw = "vim.fn.stdpath('data')..'/molten'";
|
||||||
global = "virt_lines_off_by_1";
|
use_border_highlights = false;
|
||||||
description = ''
|
virt_lines_off_by1 = false;
|
||||||
_Only has effect when `outputVirtLines` is true._
|
wrap_output = false;
|
||||||
Allows the output window to cover exactly one line of the regular buffer.
|
show_mimetype_debug = false;
|
||||||
(useful for running code in a markdown file where that covered line will just be ```)
|
|
||||||
|
|
||||||
Default: `false`
|
|
||||||
'';
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
|
|
||||||
wrapOutput = mkDefaultOpt {
|
|
||||||
global = "wrap_output";
|
|
||||||
description = ''
|
|
||||||
Wrap text in output windows.
|
|
||||||
|
|
||||||
Default: `false`
|
|
||||||
'';
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Debug
|
|
||||||
showMimetypeDebug = mkDefaultOpt {
|
|
||||||
global = "show_mimetype_debug";
|
|
||||||
description = ''
|
|
||||||
Before any non-iostream output chunk, the mime-type for that output chunk is shown.
|
|
||||||
Meant for debugging/plugin devlopment.
|
|
||||||
|
|
||||||
Default: `false`
|
|
||||||
'';
|
|
||||||
type = types.bool;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,24 +7,61 @@
|
||||||
plugins.molten = {
|
plugins.molten = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
autoOpenOutput = true;
|
settings = {
|
||||||
copyOutput = false;
|
auto_image_popup = false;
|
||||||
enterOutputBehavior = "open_then_enter";
|
auto_init_behavior = "init";
|
||||||
imageProvider = "none";
|
auto_open_html_in_browser = false;
|
||||||
outputCropBorder = true;
|
auto_open_output = true;
|
||||||
outputShowMore = false;
|
cover_empty_lines = false;
|
||||||
outputVirtLines = false;
|
cover_lines_starting_with = [];
|
||||||
outputWinBorder = ["" "━" "" ""];
|
copy_output = false;
|
||||||
outputWinCoverGutter = true;
|
enter_output_behavior = "open_then_enter";
|
||||||
outputWinHideOnLeave = true;
|
image_provider = "none";
|
||||||
outputWinMaxHeight = 999999;
|
open_cmd = null;
|
||||||
outputWinMaxWidth = 999999;
|
output_crop_border = true;
|
||||||
outputWinStyle = false;
|
output_show_more = false;
|
||||||
savePath.__raw = "vim.fn.stdpath('data')..'/molten'";
|
output_virt_lines = false;
|
||||||
useBorderHighlights = false;
|
output_win_border = ["" "━" "" ""];
|
||||||
virtLinesOffBy1 = false;
|
output_win_cover_gutter = true;
|
||||||
wrapOutput = false;
|
output_win_hide_on_leave = true;
|
||||||
showMimetypeDebug = false;
|
output_win_max_height = 999999;
|
||||||
|
output_win_max_width = 999999;
|
||||||
|
output_win_style = false;
|
||||||
|
save_path.__raw = "vim.fn.stdpath('data')..'/molten'";
|
||||||
|
tick_rate = 500;
|
||||||
|
use_border_highlights = false;
|
||||||
|
limit_output_chars = 1000000;
|
||||||
|
virt_lines_off_by_1 = false;
|
||||||
|
virt_text_output = false;
|
||||||
|
virt_text_max_lines = 12;
|
||||||
|
wrap_output = false;
|
||||||
|
show_mimetype_debug = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
example = {
|
||||||
|
plugins.molten = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
auto_open_output = true;
|
||||||
|
copy_output = false;
|
||||||
|
enter_output_behavior = "open_then_enter";
|
||||||
|
image_provider = "none";
|
||||||
|
output_crop_border = true;
|
||||||
|
output_show_more = false;
|
||||||
|
output_virt_lines = false;
|
||||||
|
output_win_border = ["" "━" "" ""];
|
||||||
|
output_win_cover_gutter = true;
|
||||||
|
output_win_hide_on_leave = true;
|
||||||
|
output_win_style = false;
|
||||||
|
save_path.__raw = "vim.fn.stdpath('data')..'/molten'";
|
||||||
|
use_border_highlights = false;
|
||||||
|
virt_lines_off_by1 = false;
|
||||||
|
wrap_output = false;
|
||||||
|
show_mimetype_debug = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue