commit fa93dee6150e36d05c17c863994fa7c0385a2314 parent b2cc3b9f92773b5741d589e6b369fb66a06fdd8f Author: Pablo Cárdenas <pablo.cardenas@imca.edu.pe> Date: Mon, 23 Jan 2023 18:23:03 -0500 Added rmd ftplugin Diffstat:
| A | ftplugin/rmd.vim | | | 17 | +++++++++++++++++ |
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/ftplugin/rmd.vim b/ftplugin/rmd.vim @@ -0,0 +1,17 @@ +map <Leader>vr :call VimuxRunCommand("clear; Rscript " . bufname("%"))<CR> +map <Leader>vo :call VimuxRunCommand("clear; R")<CR> +set softtabstop=2 +set shiftwidth=2 +set expandtab +let rmd_dynamic_comments = 0 + +function! rmd#Format() + if search("^[ \t]*```[ ]*{r", "bncW") > search("^[ \t]*```$", "bncW") + execute "silent '<,'>!Rscript\ --vanilla\ -e\ \"suppressPackageStartupMessages(library(styler));options(styler.colored_print.vertical=FALSE);con=file(\\\"stdin\\\");style_text(readLines(con),transformers=tidyverse_style());close(con)\"" + return 0 +else + return 1 + endif +endfunction + +set formatexpr=rmd#Format()