11local M = {}
2+
3+ -- globally available QuartoConfig table
4+ require ' quarto.config'
5+
26local api = vim .api
3- local cfg = require ' quarto.config'
47local tools = require ' quarto.tools'
58local util = require ' quarto.util'
69
@@ -91,7 +94,7 @@ function M.quartoPreview(opts)
9194 api .nvim_buf_set_var (0 , ' quartoOutputBuf' , quartoOutputBuf )
9295
9396 -- Close preview terminal on exit of the Quarto buffer
94- if cfg . config and cfg . config .closePreviewOnExit then
97+ if QuartoConfig .closePreviewOnExit then
9598 api .nvim_create_autocmd ({ ' QuitPre' , ' WinClosed' }, {
9699 buffer = api .nvim_get_current_buf (),
97100 group = api .nvim_create_augroup (' quartoPreview' , {}),
@@ -173,7 +176,7 @@ M.activate = function()
173176 return
174177 end
175178 local tsquery = nil
176- if cfg . config .lspFeatures .chunks == ' curly' then
179+ if QuartoConfig .lspFeatures .chunks == ' curly' then
177180 tsquery = [[
178181 (fenced_code_block
179182 (info_string
@@ -189,14 +192,14 @@ M.activate = function()
189192
190193 ]]
191194 end
192- require (' otter' ).activate (cfg . config . lspFeatures .languages , cfg . config . lspFeatures .completion .enabled , cfg . config .lspFeatures .diagnostics .enabled , tsquery )
195+ require (' otter' ).activate (QuartoConfig . lspFeatures .languages , QuartoConfig . lspFeatures .completion .enabled , QuartoConfig .lspFeatures .diagnostics .enabled , tsquery )
193196end
194197
195198-- setup
196- M .setup = function (opt )
197- cfg . config = vim .tbl_deep_extend (' force' , cfg . defaultConfig , opt or {})
199+ M .setup = function (opts )
200+ QuartoConfig = vim .tbl_deep_extend (' force' , QuartoConfig , opts or {})
198201
199- if cfg . config .codeRunner .enabled then
202+ if QuartoConfig .codeRunner .enabled then
200203 -- setup top level run functions
201204 local runner = require ' quarto.runner'
202205 M .quartoSend = runner .run_cell
0 commit comments