From d9d33333a462a9691d8e12d3cfe7c50e12118e78 Mon Sep 17 00:00:00 2001 From: yechang Date: Tue, 9 Apr 2019 02:08:44 +0800 Subject: [PATCH 1/7] fix latexindent error \n can't detect filetype --- autoload/neoformat/formatters/tex.vim | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/autoload/neoformat/formatters/tex.vim b/autoload/neoformat/formatters/tex.vim index 2422336b..37e5a368 100644 --- a/autoload/neoformat/formatters/tex.vim +++ b/autoload/neoformat/formatters/tex.vim @@ -5,8 +5,7 @@ endfunction function! neoformat#formatters#tex#latexindent() abort return { \ 'exe': 'latexindent', - \ 'args': ['-l', '-w'], - \ 'stdin': 0, - \ 'replace': 1 + \ 'args': ['-sl', '-g /dev/stderr', '2>/dev/null'], + \ 'stdin': 1, \ } endfunction From f4900561cc34deec071ef2de1daa2b7dc070f5e4 Mon Sep 17 00:00:00 2001 From: yechang Date: Sat, 20 Apr 2019 20:56:15 +0800 Subject: [PATCH 2/7] - Fix R stylr formater file not found error. - Make it quite to run a R process. --- autoload/neoformat/formatters/r.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/neoformat/formatters/r.vim b/autoload/neoformat/formatters/r.vim index 2659b103..cd35fbf9 100644 --- a/autoload/neoformat/formatters/r.vim +++ b/autoload/neoformat/formatters/r.vim @@ -5,7 +5,7 @@ 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 "styler::style_text(readr::read_file((file(\"stdin\"))))"', '2>/dev/null'], \ 'replace': 1, \} endfunction From 4fd2858d944ce7f16e3bc5af115fe276fa80f7df Mon Sep 17 00:00:00 2001 From: yechang Date: Sun, 21 Apr 2019 14:36:54 +0800 Subject: [PATCH 3/7] Add new formatter (formatR) for R language. --- autoload/neoformat/formatters/r.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/autoload/neoformat/formatters/r.vim b/autoload/neoformat/formatters/r.vim index cd35fbf9..45d767e9 100644 --- a/autoload/neoformat/formatters/r.vim +++ b/autoload/neoformat/formatters/r.vim @@ -1,5 +1,5 @@ function! neoformat#formatters#r#enabled() abort - return ['styler'] + return ['styler', 'formatR'] endfunction function! neoformat#formatters#r#styler() abort @@ -9,3 +9,11 @@ function! neoformat#formatters#r#styler() abort \ '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 From ae35f9f5e47c46cdc695628c8e08a7637e09ac83 Mon Sep 17 00:00:00 2001 From: yechang Date: Sun, 21 Apr 2019 14:56:00 +0800 Subject: [PATCH 4/7] update README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 63f9f9a9..f6cfdf95 100644 --- a/README.md +++ b/README.md @@ -337,7 +337,8 @@ that caused Neoformat to be invoked. - [`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 From b2bef229c35870656921a6d387a620530323ace2 Mon Sep 17 00:00:00 2001 From: yechang Date: Sun, 21 Apr 2019 15:07:03 +0800 Subject: [PATCH 5/7] update docs --- doc/neoformat.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/neoformat.txt b/doc/neoformat.txt index 490c0323..32ed863b 100644 --- a/doc/neoformat.txt +++ b/doc/neoformat.txt @@ -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 From 05f804bcc976bd97b67d413beaba4c27f479171f Mon Sep 17 00:00:00 2001 From: yechang Date: Sun, 21 Apr 2019 15:24:06 +0800 Subject: [PATCH 6/7] tidy up the readme --- README.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index f6cfdf95..f0daab54 100644 --- a/README.md +++ b/README.md @@ -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), @@ -312,8 +312,8 @@ 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 @@ -321,9 +321,9 @@ that caused Neoformat to be invoked. - 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) @@ -331,11 +331,11 @@ that caused Neoformat to be invoked. - 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), [`formatR`](https://github.com/yihui/formatR) @@ -343,7 +343,7 @@ that caused Neoformat to be invoked. - [`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) @@ -364,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 From 5713307c22d3d378348a1d5a0949c43d4f6a545f Mon Sep 17 00:00:00 2001 From: yechang Date: Thu, 2 May 2019 14:20:54 +0800 Subject: [PATCH 7/7] remove readr dependance --- autoload/neoformat/formatters/r.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/neoformat/formatters/r.vim b/autoload/neoformat/formatters/r.vim index 45d767e9..f4d13bba 100644 --- a/autoload/neoformat/formatters/r.vim +++ b/autoload/neoformat/formatters/r.vim @@ -5,7 +5,7 @@ endfunction function! neoformat#formatters#r#styler() abort return { \ 'exe': 'R', - \ 'args': ['--slave', '--no-restore', '--no-save', '-e "styler::style_text(readr::read_file((file(\"stdin\"))))"', '2>/dev/null'], + \ 'args': ['--slave', '--no-restore', '--no-save', '-e "con <- file(\"stdin\");styler::style_text(readLines(con));close(con)"', '2>/dev/null'], \ 'replace': 1, \} endfunction