nvim-snappy/lua/plugins/langs/md_quarto/quarto-nvim.lua

135 lines
2.6 KiB
Lua

return {
--"quarto-dev/quarto-nvim",
dir = vim.env.HOME .. '/comps/neovim/quarto-nvim',
commit = 'bfc191b2c9f973fd405e703bd0dfe11fb327a149',
lazy = true,
cmd = {
'QuartoPreview',
'QuartoPreviewNoWatch',
'QuartoUpdatePreview',
'QuartoClosePreview',
'QuartoActivate',
'QuartoHelp',
'QuartoSend',
'QuartoSendAbove',
'QuartoSendBelow',
'QuartoSendAll',
'QuartoSendRange',
'QuartoSendLine',
},
keys = {
{
']c',
function()
require('nvim-treesitter.textobjects.move').goto_next_start('@cell.inner', 'textobjects')
end,
desc = 'Goto Next [C]ell Start',
},
{
'[c',
function()
require('nvim-treesitter.textobjects.move').goto_previous_start('@cell.inner', 'textobjects')
end,
desc = 'Goto Prev [C]ell Start',
},
{
']C',
function()
require('nvim-treesitter.textobjects.move').goto_next_end('@cell.outer', 'textobjects')
end,
desc = 'Goto Next [C]ell End',
},
{
'[C',
function()
require('nvim-treesitter.textobjects.move').goto_previous_end('@cell.outer', 'textobjects')
end,
desc = 'Goto Prev [C]ell End',
},
-- Jupyter / Notebooks
--- <leader>j
{
'<leader>jl',
function()
require('quarto.runner').run_cell()
--vim.cmd(':noautocmd MoltenEnterOutput')
end,
desc = '[J]upyter Run Ce[L]l',
silent = true,
},
{
'<leader>jL',
function()
require('quarto.runner').run_cell()
vim.cmd(':MoltenOpenInBrowser')
end,
desc = '[J]upyter Run Ce[L]l',
},
{
'<leader>j;',
function()
require('quarto.runner').run_cell()
require('nvim-treesitter.textobjects.move').goto_next_start('@cell.inner', 'textobjects')
end,
desc = '[J]upyter Run Cell and Skip',
},
{
'<leader>jk',
function()
require('quarto.runner').run_above()
end,
desc = '[J]upyter Run Cell Above',
},
{
'<leader>jA',
function()
require('quarto.runner').run_all()
end,
desc = '[J]upyter Run Cell Below',
},
{
'<leader>j,',
function()
require('quarto.runner').run_line()
end,
desc = '[J]upyter Run L[I]ne',
},
{
'<leader>jp',
function()
require('quarto').quartoPreview()
end,
desc = '[J]upyter Start [P]review',
},
{
'<leader>jP',
function()
require('quarto').quartoStopPreview()
end,
desc = '[J]upyter Stop [P]review',
},
},
init = function()
vim.treesitter.language.register('markdown', { 'quarto', 'rmd' })
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'quarto' },
callback = function(ev)
require('quarto').activate()
end,
})
end,
opts = {
venv = {
enabled = true,
},
codeRunner = {
default_method = 'molten',
},
},
}