File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,37 @@ function M.quartoPreview(opts)
1717 local cmd
1818 local mode
1919
20+
21+ -- check for
22+ --
23+ -- editor:
24+ -- render-on-save: false
25+ --
26+ -- in _quarto.yml or the current qmd file
27+
28+ local render_on_save = true
29+
30+ local lines
31+ if root_dir then
32+ local quarto_config = root_dir .. ' /_quarto.yml'
33+ lines = vim .fn .readfile (quarto_config )
34+ else
35+ -- assumption: the yaml header is not longer than a generous 500 lines
36+ lines = vim .api .nvim_buf_get_lines (0 , 0 , 500 , false )
37+ end
38+
39+ local query = ' render%-on%-save: false'
40+ for _ , line in ipairs (lines ) do
41+ if line :find (query ) then
42+ render_on_save = false
43+ break
44+ end
45+ end
46+
47+ if not render_on_save and string.find (args , ' %-%-no%-watch%-inputs' ) == nil then
48+ args = args .. ' --no-watch-inputs'
49+ end
50+
2051 if root_dir then
2152 mode = ' project'
2253 cmd = ' quarto preview ' .. args
You can’t perform that action at this time.
0 commit comments