Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ that caused Neoformat to be invoked.
- GraphQL
- [`prettier`](https://github.com/prettier/prettier)
- Haskell
- [`stylish-haskell`](https://github.com/jaspervdj/stylish-haskell)
- [`hindent`](https://github.com/chrisdone/hindent)
- [`hfmt`](https://github.com/danstiner/hfmt)
- [`brittany`](https://github.com/lspitzner/brittany)
- [`sort-imports`](https://github.com/evanrelf/sort-imports)
- [`floskell`](https://github.com/ennocramer/floskell)
- [`stylish-haskell`](https://github.com/jaspervdj/stylish-haskell),
[`hindent`](https://github.com/chrisdone/hindent),
[`hfmt`](https://github.com/danstiner/hfmt),
[`brittany`](https://github.com/lspitzner/brittany),
[`sort-imports`](https://github.com/evanrelf/sort-imports),
[`floskell`](https://github.com/ennocramer/floskell)
- HTML
- `html-beautify` (ships with [`js-beautify`](https://github.com/beautify-web/js-beautify)),
[`prettier`](https://github.com/prettier/prettier),
Expand Down Expand Up @@ -312,37 +312,38 @@ that caused Neoformat to be invoked.
[`clang-format`](http://clang.llvm.org/docs/ClangFormat.html),
[`astyle`](http://astyle.sourceforge.net)
- OCaml
- [`ocp-indent`](http://www.typerex.org/ocp-indent.html)
- [`ocamlformat`](https://github.com/ocaml-ppx/ocamlformat)
- [`ocp-indent`](http://www.typerex.org/ocp-indent.html),
[`ocamlformat`](https://github.com/ocaml-ppx/ocamlformat)
- Pandoc Markdown
- [`pandoc`](https://pandoc.org/MANUAL.html)
- Pawn
- [`uncrustify`](http://uncrustify.sourceforge.net)
- Perl
- [`perltidy`](http://perltidy.sourceforge.net)
- PHP
- [`php_beautifier`](http://pear.php.net/package/PHP_Beautifier)
- [`php-cs-fixer`](http://cs.sensiolabs.org/)
- [`phpcbf`](https://github.com/squizlabs/PHP_CodeSniffer)
- [`php_beautifier`](http://pear.php.net/package/PHP_Beautifier),
[`php-cs-fixer`](http://cs.sensiolabs.org/),
[`phpcbf`](https://github.com/squizlabs/PHP_CodeSniffer)
- Proto
- [`clang-format`](http://clang.llvm.org/docs/ClangFormat.html)
- Pug (formally Jade)
- [`pug-beautifier`](https://github.com/vingorius/pug-beautifier)
- Python
- [`yapf`](https://github.com/google/yapf),
[`autopep8`](https://github.com/hhatto/autopep8),
[`black`](https://github.com/ambv/black)
[`pydevf`](https://github.com/fabioz/PyDev.Formatter)
- [`isort`](https://github.com/timothycrosley/isort)
- [`docformatter`](https://github.com/myint/docformatter)
- [`pyment`](https://github.com/dadadel/pyment)
[`black`](https://github.com/ambv/black),
[`pydevf`](https://github.com/fabioz/PyDev.Formatter),
[`isort`](https://github.com/timothycrosley/isort),
[`docformatter`](https://github.com/myint/docformatter),
[`pyment`](https://github.com/dadadel/pyment)
- R
- [styler](https://github.com/r-lib/styler)
- [`styler`](https://github.com/r-lib/styler),
[`formatR`](https://github.com/yihui/formatR)
- Reason
- [`refmt`](https://github.com/facebook/reason)
- Ruby
- [`rufo`](https://github.com/ruby-formatter/rufo),
- [`ruby-beautify`](https://github.com/erniebrodeur/ruby-beautify),
[`ruby-beautify`](https://github.com/erniebrodeur/ruby-beautify),
[`rubocop`](https://github.com/bbatsov/rubocop)
- Rust
- [`rustfmt`](https://github.com/rust-lang-nursery/rustfmt)
Expand All @@ -363,9 +364,9 @@ that caused Neoformat to be invoked.
- Shell
- [`shfmt`](https://github.com/mvdan/sh)
- SQL
- [`sqlfmt`](https://github.com/jackc/sqlfmt)
- `sqlformat` (ships with [sqlparse](https://github.com/andialbrecht/sqlparse))
- `pg_format` (ships with [pgFormatter](https://github.com/darold/pgFormatter))
- [`sqlfmt`](https://github.com/jackc/sqlfmt),
`sqlformat` (ships with [sqlparse](https://github.com/andialbrecht/sqlparse)),
`pg_format` (ships with [pgFormatter](https://github.com/darold/pgFormatter))
- Swift
- [`Swiftformat`](https://github.com/nicklockwood/SwiftFormat)
- Terraform
Expand Down
12 changes: 10 additions & 2 deletions autoload/neoformat/formatters/r.vim
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
function! neoformat#formatters#r#enabled() abort
return ['styler']
return ['styler', 'formatR']
endfunction

function! neoformat#formatters#r#styler() abort
return {
\ 'exe': 'R',
\ 'args': ['-e "library(styler)"', '-e "style_file(\"%:p\")"'],
\ 'args': ['--slave', '--no-restore', '--no-save', '-e "con <- file(\"stdin\");styler::style_text(readLines(con));close(con)"', '2>/dev/null'],
\ 'replace': 1,
\}
endfunction

function! neoformat#formatters#r#formatR() abort
return {
\ 'exe': 'R',
\ 'args': ['--slave', '--no-restore', '--no-save', '-e "formatR::tidy_source(\"stdin\", arrow=FALSE)"', '2>/dev/null'],
\ 'stdin': 1,
\}
endfunction
3 changes: 2 additions & 1 deletion doc/neoformat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ SUPPORTED FILETYPES *neoformat-supported-filetypes*
[`docformatter`](https://github.com/myint/docformatter),
[`pyment`](https://github.com/dadadel/pyment)
- R
- [styler](https://github.com/r-lib/styler)
- [`styler`](https://github.com/r-lib/styler),
[`formatR`](https://github.com/yihui/formatR)
- Reason
- [`refmt`](https://github.com/facebook/reason)
- Ruby
Expand Down