Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling render on save in nvim #155

Closed
rrgalvan opened this issue Dec 8, 2024 · 11 comments
Closed

Disabling render on save in nvim #155

rrgalvan opened this issue Dec 8, 2024 · 11 comments
Labels
enhancement New feature or request

Comments

@rrgalvan
Copy link

rrgalvan commented Dec 8, 2024

I am very happy using quarto in nvim.

But I would like to disable automatic rendering of .qmd files when the document is saved, because rendering takes a lot of time for some of my documents.

I tried writing

editor: 
  render-on-save: false

in the header of the document. No success. Any idea?

@jmbuhr jmbuhr added the enhancement New feature or request label Dec 20, 2024
@jmbuhr
Copy link
Collaborator

jmbuhr commented Dec 22, 2024

I just added two user commands in #157, QuartoPreviewNoWatch and QuartoUpdatePreview, the first starts the preview server without watching inputs (i.e. it doesn't re-render on save) and the second is for manually sending the re-render request to the server. Let me know if that works for you :)

@jmbuhr
Copy link
Collaborator

jmbuhr commented Dec 22, 2024

Plus #159 to detect render-on-save: false automatically.

@jmbuhr jmbuhr closed this as completed Dec 22, 2024
@rrgalvan
Copy link
Author

rrgalvan commented Jan 7, 2025

Thank you very much,

now render-on-save:false works like a charm!

Comment: for this option to be recognized, I need to close the buffer and open it again (not a big deal).

@jmbuhr
Copy link
Collaborator

jmbuhr commented Jan 7, 2025

This is unexpected, the header should be scanned every time QuartoUpdatePreview is called. Was it just because the update had to go through or is this still the case?

@rrgalvan
Copy link
Author

rrgalvan commented Jan 7, 2025

I think this issue is not related to the update. After updating the plugin (I am using Lazy.nvim), I close nvim and open it again with the following file:

---
title: "Quarto Test"
---

Testing `render-on-save: false`

```{python}
x = 0
x

Then I call `QuartoPreview` and everything works: if I modify one line (I write `x = 1`) and save the buffer, the changes are not rendered.

But if I set `render-on-save: true` in the header, changes are still not rendered.

More info, if now I call :QuartoUpdatePreview from the command line the changes are rendered and, from this moment on, changes will be rendered whenever I modify and save.

@jmbuhr
Copy link
Collaborator

jmbuhr commented Jan 7, 2025

Right, you don't have to re-open the buffer, just close the quarto preview server and call QuartoPreview again.

@jmbuhr
Copy link
Collaborator

jmbuhr commented Jan 7, 2025

render-on-save changes how the preview server is started, but it can not change a running server.

@rrgalvan
Copy link
Author

rrgalvan commented Jan 7, 2025

OK, I understand. Tank you again!!

@rrgalvan
Copy link
Author

rrgalvan commented Jan 7, 2025

Maybe the workflow would be more easy to understand the if you rename the command "QuartoUpdatePreview" to "QuartoParseAndPreview", "QuartoApplyHeadder" or something like that.

@jmbuhr
Copy link
Collaborator

jmbuhr commented Jan 7, 2025

QuartoUpdatePreview has nothing to do with the header, it just sends the command to re-render the preview. The header is only relevant for how the preview server is started. Maybe QuartoRerenderPreview would be a better name, but Update is more general.

@rrgalvan
Copy link
Author

rrgalvan commented Jan 8, 2025

OK, thank you again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants