I am trying to autogenerate an output every time I save the file with :update or with :w. This is what I got so far:
augroup renderRmd | au!
autocmd BufWritePost *.rmd !'Rscript -e "rmarkdown::render(<afile>:p:S)"'
augroup end
But I get:
:!'Rscript -e "rmarkdown::render('/home/luis/Documents/2020-CamCAN/src/2021-09-1
8-time-series.rmd')"'
zsh:1: no such file or directory: Rscript -e "rmarkdown::render(/home/luis/Docum
ents/2020-CamCAN/src/2021-09-18-time-series.rmd)"
Running Rscript -e "rmarkdown::render('/home/luis/Documents/2020-CamCAN/src/2021-09-1 8-time-series.rmd')"
in zsh works as expected. I feel like this is something with the expansion of the name, but I can´t figure it out.
Also, it does not work with :update, only with :w
extra points if this is run asynchronously from Vim, or some kind of run in the background.
:terminal
or tpope’s dispatch plugin could run asynchronously.<afile>
is. :) The error message is looking at the whole command line as a file, though....that's what the error is. It's from the single quotes.