mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-22 08:53:28 +02:00
plugins/jupytext: init
This commit is contained in:
parent
a94425245b
commit
b658169f11
3 changed files with 102 additions and 0 deletions
|
@ -62,6 +62,7 @@
|
||||||
./languages/openscad.nix
|
./languages/openscad.nix
|
||||||
./languages/parinfer-rust.nix
|
./languages/parinfer-rust.nix
|
||||||
./languages/plantuml-syntax.nix
|
./languages/plantuml-syntax.nix
|
||||||
|
./languages/python/jupytext.nix
|
||||||
./languages/rust-tools.nix
|
./languages/rust-tools.nix
|
||||||
./languages/rustaceanvim.nix
|
./languages/rustaceanvim.nix
|
||||||
./languages/sniprun.nix
|
./languages/sniprun.nix
|
||||||
|
|
66
plugins/languages/python/jupytext.nix
Normal file
66
plugins/languages/python/jupytext.nix
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
helpers,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib;
|
||||||
|
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||||
|
name = "jupytext";
|
||||||
|
originalName = "jupytext.nvim";
|
||||||
|
defaultPackage = pkgs.vimPlugins.jupytext-nvim;
|
||||||
|
|
||||||
|
maintainers = [maintainers.GaetanLepage];
|
||||||
|
|
||||||
|
settingsOptions = {
|
||||||
|
style = helpers.defaultNullOpts.mkStr "hydrogen" ''
|
||||||
|
The jupytext style to use.
|
||||||
|
'';
|
||||||
|
|
||||||
|
output_extension = helpers.defaultNullOpts.mkStr "auto" ''
|
||||||
|
By default, the extension of the plain text file is automatically selected by jupytext.
|
||||||
|
This can be modified by changing the extension from auto to any other file extension supported
|
||||||
|
by Jupytext.
|
||||||
|
This is most useful to those using Quarto or Markdown.
|
||||||
|
Analogously, we can provide a default filetype that will be given to the new buffer by using
|
||||||
|
`force_ft`.
|
||||||
|
Again, this is only really useful to users of Quarto.
|
||||||
|
'';
|
||||||
|
|
||||||
|
force_ft = helpers.mkNullOrStr ''
|
||||||
|
Default filetype. Don't change unless you know what you are doing.
|
||||||
|
'';
|
||||||
|
|
||||||
|
custom_language_formatting = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
|
||||||
|
By default we use the auto mode of jupytext.
|
||||||
|
This will create a script with the correct extension for each language.
|
||||||
|
However, this can be overridden in a per language basis if you want to.
|
||||||
|
For this you can set this option.
|
||||||
|
|
||||||
|
For example, to convert python files to quarto markdown:
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
python = {
|
||||||
|
extension = "qmd";
|
||||||
|
style = "quarto";
|
||||||
|
force_ft = "quarto";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
settingsExample = {
|
||||||
|
style = "light";
|
||||||
|
output_extension = "auto";
|
||||||
|
force_ft = null;
|
||||||
|
custom_language_formatting = {
|
||||||
|
python = {
|
||||||
|
extension = "md";
|
||||||
|
style = "markdown";
|
||||||
|
force_ft = "markdown";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
35
tests/test-sources/plugins/languages/python/jupytext.nix
Normal file
35
tests/test-sources/plugins/languages/python/jupytext.nix
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
empty = {
|
||||||
|
plugins.jupytext.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
defaults = {
|
||||||
|
plugins.jupytext = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
style = "hydrogen";
|
||||||
|
output_extension = "auto";
|
||||||
|
force_ft = null;
|
||||||
|
custom_language_formatting = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
example = {
|
||||||
|
plugins.jupytext = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
style = "light";
|
||||||
|
output_extension = "auto";
|
||||||
|
force_ft = null;
|
||||||
|
custom_language_formatting.python = {
|
||||||
|
extension = "md";
|
||||||
|
style = "markdown";
|
||||||
|
force_ft = "markdown";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue