Created
March 27, 2015 15:44
-
-
Save stevenpollack/8766b1540c615db5aaf7 to your computer and use it in GitHub Desktop.
Use Rscript to call the "rmarkdown" render function on currently open .rmd file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" have vimr-plugin call rmarkdown::render | |
function! RenderRMarkdown() | |
" set autoread to supress W11 warning: | |
" vim is going to complain about the rmd file already existing... | |
:set autoread | |
" get full file path via %:p | |
! Rscript -e "rmarkdown::render(commandArgs(TRUE)[2])" --args %:p | |
endfunction | |
" call RenderRMarkdown silently to suppress the "Press ENTER to continue" prompt | |
nnoremap <F2> :silent :call RenderRMarkdown() <CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment