AstroNvim / AstroNvim/astrocommunity

Better setup for quarto

Open
#1,329 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue
Dominant language
Lua
Stars
1.7k
Forks
313
PR merge metrics
No merged PRs in 30d

Description

Hello,

I am trying to implement some more feature to the quarto pack like syntax hilghtings, snippets, send code.
Like you can find in quarto kickstarter [](https://github.com/jmbuhr/quarto-nvim-kickstarter)

- [ ] vim-slim is not working properly to send code to ipython ➡ I have error Terminal not found (after opening it)

- [ ] mini-snippets might work

- [ ] syntax highlighting of code chunck

- [ ] Implement leader key for quarto commands ➡ Require a better mapping

### Describe the new feature

Here is the config file I tried to implement but without that much success

```lua
return {

{
"quarto-dev/quarto-nvim",
opts = {
lspFeatures = {
languages = { "r", "python", "julia", "bash", "html", "lua" },
},
},
ft = "quarto",
keys = {
{ "qa", ":QuartoActivate", desc = "quarto activate" },
{ "qp", ":lua require'quarto'.quartoPreview()", desc = "quarto preview" },
{ "qq", ":lua require'quarto'.quartoClosePreview()", desc = "quarto close" },
{ "qh", ":QuartoHelp ", desc = "quarto help" },
{ "qe", ":lua require'otter'.export()", desc = "quarto export" },
{ "qE", ":lua require'otter'.export(true)", desc = "quarto export overwrite" },
{ "qrr", ":QuartoSendAbove", desc = "quarto run to cursor" },
{ "qra", ":QuartoSendAll", desc = "quarto run all" },
{ "", ":SlimeSendCell", desc = "send code chunk" },
{ "", ":SlimeSendCell", desc = "send code chunk" },
{ "", ":SlimeSendCelli", mode = "i", desc = "send code chunk" },
{ "", "SlimeRegionSend", mode = "v", desc = "send code chunk" },
{ "", "SlimeRegionSend", mode = "v", desc = "send code chunk" },
{ "tr", ":split term://R", desc = "terminal: R" },
{ "ti", ":vsplit term://ipython", desc = "terminal: ipython" },
{ "tp", ":split term://python", desc = "terminal: python" },
{ "tj", ":split term://julia", desc = "terminal: julia" },
},


},

{
"jmbuhr/otter.nvim",
opts = {
buffers = {
set_filetype = true,
},
},
},

{
"hrsh7th/nvim-cmp",
dependencies = { "jmbuhr/otter.nvim" },
opts = function(_, opts)
---@param opts cmp.ConfigSchema
local cmp = require("cmp")
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "otter" } }))
end,
},

-- send code from python/r/qmd documets to a terminal or REPL
-- like ipython, R, bash
{
"jpalardy/vim-slime",
init = function()
vim.b["quarto_is_" .. "python" .. "_chunk"] = false
Quarto_is_in_python_chunk = function()
require("otter.tools.functions").is_otter_language_context("python")
end

vim.cmd([[
let g:slime_dispatch_ipython_pause = 100
function SlimeOverride_EscapeText_quarto(text)
call v:lua.Quarto_is_in_python_chunk()
if exists('g:slime_python_ipython') && len(split(a:text,"\n")) > 1 && b:quarto_is_python_chunk
return ["%cpaste -q\n", g:slime_dispatch_ipython_pause, a:text, "--", "\n"]
else
return a:text
end
endfunction
]])

local function mark_terminal()
vim.g.slime_last_channel = vim.b.terminal_job_id
vim.print(vim.g.slime_last_channel)
end

local function set_terminal()
vim.b.slime_config = { jobid = vim.g.slime_last_channel }
end

-- slime, neovvim terminal
vim.g.slime_target = "neovim"
vim.g.slime_python_ipython = 1

keys={
["cm"] = { mark_terminal, desc="mark terminal" },
["cs"] = { set_terminal, desc="set terminal" },
}
end,
},

{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
pyright = {},
r_language_server = {},
julials = {},
marksman = {
-- also needs:
-- $home/.config/marksman/config.toml :
-- [core]
-- markdown.file_extensions = ["md", "markdown", "qmd"]
filetypes = { "markdown", "quarto" },
root_dir = require("lspconfig.util").root_pattern(".git", ".marksman.toml", "_quarto.yml"),
},
},
},
},

{
"nvim-treesitter/nvim-treesitter",
optional = true,
opts = function(_, opts)
if opts.ensure_installed ~= "all" then
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
"bash",
"c",
"html",
"javascript",
"json",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"vimdoc",
"yaml",
"bash",
"html",
"css",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"vim",
"yaml",
"python",
"julia",
"r",
})
end
end,
}
}
```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

The issue names no repository files or tests; start by locating the existing Quarto-related plugin specification and checking how AstroNvim configures quarto.nvim, otter.nvim, vim-slime, LSP, and Treesitter. Narrow the request to one behavior—terminal code sending, snippets, highlighting, or mappings—and define done with a reproducible setup and targeted verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, julia, lua, neovim, python, r
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.