Skip to content

Commit

Permalink
Merge branch 'master' into range
Browse files Browse the repository at this point in the history
  • Loading branch information
bzvl authored Dec 21, 2018
2 parents ba1be90 + fec5be9 commit e1810d5
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 17 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ 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))
- Swift
Expand All @@ -358,7 +359,8 @@ that caused Neoformat to be invoked.
- [`terraform`](https://www.terraform.io/docs/commands/fmt.html),
- Typescript
- [`tsfmt`](https://github.com/vvakame/typescript-formatter),
[`prettier`](https://github.com/prettier/prettier)
[`prettier`](https://github.com/prettier/prettier),
[`tslint`](https://palantir.github.io/tslint)
- VALA
- [`uncrustify`](http://uncrustify.sourceforge.net)
- Vue
Expand Down
9 changes: 7 additions & 2 deletions autoload/neoformat.vim
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,13 @@ function! s:generate_cmd(definition, filetype) abort
let stderr_log = expand(tmp_dir . '/stderr.log')
let fullcmd = fullcmd . ' 2> ' . stderr_log
else
let stderr_log = ''
let fullcmd = fullcmd . ' 2> ' . '/dev/null'
if (has('win32') || has('win64'))
let stderr_log = ''
let fullcmd = fullcmd . ' 2> ' . 'NUL'
else
let stderr_log = ''
let fullcmd = fullcmd . ' 2> ' . '/dev/null'
endif
endif
endif

Expand Down
2 changes: 1 addition & 1 deletion autoload/neoformat/formatters/css.vim
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ endfunction
function! neoformat#formatters#css#prettier() abort
return {
\ 'exe': 'prettier',
\ 'args': ['--stdin', '--stdin-filepath', '%:p', '--parser', 'css'],
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"', '--parser', 'css'],
\ 'stdin': 1
\ }
endfunction
2 changes: 1 addition & 1 deletion autoload/neoformat/formatters/graphql.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ endfunction
function! neoformat#formatters#graphql#prettier() abort
return {
\ 'exe': 'prettier',
\ 'args': ['--stdin', '--stdin-filepath', '%:p', '--parser', 'graphql'],
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"', '--parser', 'graphql'],
\ 'stdin': 1
\ }
endfunction
4 changes: 2 additions & 2 deletions autoload/neoformat/formatters/javascript.vim
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ endfunction
function! neoformat#formatters#javascript#prettiereslint() abort
return {
\ 'exe': 'prettier-eslint',
\ 'args': ['--stdin', '--stdin-filepath', '%:p'],
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"'],
\ 'stdin': 1,
\ }
endfunction

function! neoformat#formatters#javascript#eslint_d() abort
return {
\ 'exe': 'eslint_d',
\ 'args': ['--stdin', '--stdin-filename', '%:p', '--fix-to-stdout'],
\ 'args': ['--stdin', '--stdin-filename', '"%:p"', '--fix-to-stdout'],
\ 'stdin': 1,
\ }
endfunction
Expand Down
2 changes: 1 addition & 1 deletion autoload/neoformat/formatters/json.vim
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ endfunction
function! neoformat#formatters#json#prettier() abort
return {
\ 'exe': 'prettier',
\ 'args': ['--stdin', '--stdin-filepath', '%:p', '--parser', 'json'],
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"', '--parser', 'json'],
\ 'stdin': 1,
\ }
endfunction
Expand Down
2 changes: 1 addition & 1 deletion autoload/neoformat/formatters/markdown.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ endfunction
function! neoformat#formatters#markdown#prettier() abort
return {
\ 'exe': 'prettier',
\ 'args': ['--stdin', '--stdin-filepath', '%:p'],
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"'],
\ 'stdin': 1,
\ }
endfunction
Expand Down
2 changes: 1 addition & 1 deletion autoload/neoformat/formatters/ocaml.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ endfunction
function! neoformat#formatters#ocaml#ocamlformat() abort
return {
\ 'exe': 'ocamlformat',
\ 'args': ['--name', '%:p']
\ 'args': ['--name', '"%:p"']
\ }
endfunction
2 changes: 1 addition & 1 deletion autoload/neoformat/formatters/ruby.vim
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ endfunction
function! neoformat#formatters#ruby#rubocop() abort
return {
\ 'exe': 'rubocop',
\ 'args': ['--auto-correct', '--stdin', '%:p', '2>/dev/null', '|', 'sed "1,/^====================$/d"'],
\ 'args': ['--auto-correct', '--stdin', '"%:p"', '2>/dev/null', '|', 'sed "1,/^====================$/d"'],
\ 'stdin': 1,
\ 'stderr': 1
\ }
Expand Down
10 changes: 9 additions & 1 deletion autoload/neoformat/formatters/sql.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function! neoformat#formatters#sql#enabled() abort
return ['sqlformat', 'pg_format']
return ['sqlformat', 'pg_format', 'sqlfmt']
endfunction

function! neoformat#formatters#sql#sqlformat() abort
Expand All @@ -17,3 +17,11 @@ function! neoformat#formatters#sql#pg_format() abort
\ 'stdin': 1,
\ }
endfunction

function! neoformat#formatters#sql#sqlfmt() abort
return {
\ 'exe': 'sqlfmt',
\ 'args': [],
\ 'stdin': 1,
\ }
endfunction
12 changes: 10 additions & 2 deletions autoload/neoformat/formatters/typescript.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function! neoformat#formatters#typescript#enabled() abort
return ['tsfmt', 'prettier']
return ['tsfmt', 'prettier', 'tslint']
endfunction

function! neoformat#formatters#typescript#tsfmt() abort
Expand All @@ -13,7 +13,15 @@ endfunction
function! neoformat#formatters#typescript#prettier() abort
return {
\ 'exe': 'prettier',
\ 'args': ['--stdin', '--stdin-filepath', '%:p', '--parser', 'typescript'],
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"', '--parser', 'typescript'],
\ 'stdin': 1
\ }
endfunction

function! neoformat#formatters#typescript#tslint() abort
return {
\ 'exe': 'tslint',
\ 'args': ['--fix', '-c tslint.json'],
\ 'replace': 1
\ }
endfunction
2 changes: 1 addition & 1 deletion autoload/neoformat/formatters/vue.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ endfunction
function! neoformat#formatters#vue#prettier() abort
return {
\ 'exe': 'prettier',
\ 'args': ['--stdin', '--stdin-filepath', '%:p', '--parser', 'vue'],
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"', '--parser', 'vue'],
\ 'stdin': 1
\ }
endfunction
2 changes: 1 addition & 1 deletion autoload/neoformat/formatters/yaml.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endfunction
function! neoformat#formatters#yaml#prettier() abort
return {
\ 'exe': 'prettier',
\ 'args': ['--stdin', '--stdin-filepath', '%:p', '--parser', 'yaml'],
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"', '--parser', 'yaml'],
\ 'stdin': 1
\ }
endfunction
5 changes: 4 additions & 1 deletion doc/neoformat.txt
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,17 @@ SUPPORTED FILETYPES *neoformat-supported-filetypes*
- 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))
- Swift
- [`Swiftformat`](https://github.com/nicklockwood/SwiftFormat)
- Terraform
- [`terraform`](https://www.terraform.io/docs/commands/fmt.html)
- Typescript
- [`tsfmt`](https://github.com/vvakame/typescript-formatter)
- [`tsfmt`](https://github.com/vvakame/typescript-formatter),
[`prettier`](https://github.com/prettier/prettier),
[`tslint`](https://palantir.github.io/tslint)
- VALA
- [`uncrustify`](http://uncrustify.sourceforge.net)
- Vue
Expand Down

0 comments on commit e1810d5

Please sign in to comment.