vimrc

My Vim configuration
git clone git://pcardenasb.com/vimrc
Log | Files | Refs | Submodules

rmd.vim (643B)


      1 map <Leader>vr :call VimuxRunCommand("clear; Rscript " . bufname("%"))<CR>
      2 map <Leader>vo :call VimuxRunCommand("clear; R")<CR>
      3 setlocal softtabstop=2
      4 setlocal shiftwidth=2
      5 setlocal expandtab
      6 let rmd_dynamic_comments = 0
      7 
      8 function! rmd#Format()
      9   if search("^[ \t]*```[ ]*{r", "bncW") > search("^[ \t]*```$", "bncW")
     10     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)\""
     11     return 0
     12 else
     13     return 1
     14   endif
     15 endfunction
     16 
     17 setlocal formatexpr=rmd#Format()