summaryrefslogtreecommitdiff
path: root/autoload/ale/fixers/styler.vim
blob: 1c7607bd3e5c4d1d4b1160849c64801a991e5185 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
" Author: tvatter <thibault.vatter@gmail.com>
" Description: Fixing R files with styler.

call ale#Set('r_styler_executable', 'Rscript')
call ale#Set('r_styler_options', 'tidyverse_style()')

function! ale#fixers#styler#Fix(buffer) abort
    return {
    \   'command': 'Rscript --vanilla -e '
    \       . '"suppressPackageStartupMessages(library(styler));'
    \       . 'style_file(commandArgs(TRUE), transformers = '
    \       . ale#Var(a:buffer, 'r_styler_options') . ')"'
    \       . ' %t',
    \   'read_temporary_file': 1,
    \}
endfunction