nvim: Open ipynb files as quarto files

We can now open any ipynb file as if it were a quarto document by
leveraging the `jupytext.nvim` extension which works in the background
to convert everything. Will only work if `jupytext` program is actually
installed on the machine.

Allows normal editing of the file and will write any changes back to the
original notebook on save and exit!
This commit is contained in:
Marty Oehme 2024-06-16 21:32:56 +02:00
parent 4d8cc4d2af
commit 3b1a874883
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 24 additions and 0 deletions

View file

@ -35,6 +35,7 @@
"glance.nvim": { "branch": "master", "commit": "51059bcf21016387b6233c89eed220cf47fca752" }, "glance.nvim": { "branch": "master", "commit": "51059bcf21016387b6233c89eed220cf47fca752" },
"headlines.nvim": { "branch": "master", "commit": "618ef1b2502c565c82254ef7d5b04402194d9ce3" }, "headlines.nvim": { "branch": "master", "commit": "618ef1b2502c565c82254ef7d5b04402194d9ce3" },
"image.nvim": { "branch": "master", "commit": "da64ce69598875c9af028afe129f916b02ccc42e" }, "image.nvim": { "branch": "master", "commit": "da64ce69598875c9af028afe129f916b02ccc42e" },
"jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" },
"lazy.nvim": { "branch": "main", "commit": "fafe1f7c640aed75e70a10e6649612cd96f39149" }, "lazy.nvim": { "branch": "main", "commit": "fafe1f7c640aed75e70a10e6649612cd96f39149" },
"lsp-setup.nvim": { "branch": "main", "commit": "6e4e977512ce426d8b52c27f3b6e6aefc73e1452" }, "lsp-setup.nvim": { "branch": "main", "commit": "6e4e977512ce426d8b52c27f3b6e6aefc73e1452" },
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },

View file

@ -221,4 +221,27 @@ return {
}, },
lazy = false, lazy = false,
}, },
-- Open ipynb Jupyter notebooks as if they're quarto files
-- requires jupytext to be installed
{
"GCBallesteros/jupytext.nvim",
opts = {
style = "light",
custom_language_formatting = {
python = {
extension = "qmd",
style = "quarto",
force_ft = "quarto",
},
r = {
extension = "qmd",
style = "quarto",
force_ft = "quarto",
},
},
},
cond = vim.fn.executable("jupytext") == 1, -- only runs if imagemagick installed
lazy = false -- does not work in lazy mode
},
} }