mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 17:49:57 +08:00
feat(bundle#neoformat): Update neoformat from 1a49552c to f1b6cd50
This commit is contained in:
parent
f8280b55f7
commit
362485ea23
@ -11,7 +11,7 @@ In `bundle/` directory, there are two kinds of plugins: forked plugins without c
|
|||||||
|
|
||||||
- [defx.nvim](https://github.com/Shougo/defx.nvim/tree/df5e6ea6734dc002919ea41786668069fa0b497d)
|
- [defx.nvim](https://github.com/Shougo/defx.nvim/tree/df5e6ea6734dc002919ea41786668069fa0b497d)
|
||||||
- [dein.vim](https://github.com/Shougo/dein.vim/tree/772ae08cef5e712b2b31b4aaee908fc853accd94)
|
- [dein.vim](https://github.com/Shougo/dein.vim/tree/772ae08cef5e712b2b31b4aaee908fc853accd94)
|
||||||
- [neoformat](https://github.com/sbdchd/neoformat/tree/1a49552cdaddeaaa766a6f0016effe530634b39f)
|
- [neoformat](https://github.com/sbdchd/neoformat/tree/f1b6cd506b72be0a2aaf529105320ec929683920)
|
||||||
- [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim/tree/17a83ea765831cb0cc64f768b8c3f43479b90bbe)
|
- [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim/tree/17a83ea765831cb0cc64f768b8c3f43479b90bbe)
|
||||||
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig/tree/507f8a570ac2b8b8dabdd0f62da3b3194bf822f8)
|
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig/tree/507f8a570ac2b8b8dabdd0f62da3b3194bf822f8)
|
||||||
- [deoplete-lsp](https://github.com/deoplete-plugins/deoplete-lsp/tree/6299a22bedfb4f814d95cb0010291501472f8fd0)
|
- [deoplete-lsp](https://github.com/deoplete-plugins/deoplete-lsp/tree/6299a22bedfb4f814d95cb0010291501472f8fd0)
|
||||||
|
@ -57,7 +57,9 @@ The `undojoin` command will put changes made by Neoformat into the same
|
|||||||
[Managing Undo History](#managing-undo-history).
|
[Managing Undo History](#managing-undo-history).
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
The best way to install Neoformat is with your favorite plugin manager for Vim, such as [vim-plug](https://github.com/junegunn/vim-plug):
|
The best way to install Neoformat is with your favorite plugin manager for Vim, such as [vim-plug](https://github.com/junegunn/vim-plug):
|
||||||
|
|
||||||
```viml
|
```viml
|
||||||
Plug 'sbdchd/neoformat'
|
Plug 'sbdchd/neoformat'
|
||||||
```
|
```
|
||||||
@ -74,16 +76,17 @@ Define custom formatters.
|
|||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
| name | description | default | optional / required |
|
| name | description | default | optional / required |
|
||||||
| ------------------ | ----------------------------------------------------------------------------------------------------------------- | ------- | ------------------- |
|
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------- |
|
||||||
| `exe` | the name the formatter executable in the path | n/a | **required** |
|
| `exe` | the name the formatter executable in the path | n/a | **required** |
|
||||||
| `args` | list of arguments | \[] | optional |
|
| `args` | list of arguments | \[] | optional |
|
||||||
| `replace` | overwrite the file, instead of updating the buffer | 0 | optional |
|
| `replace` | overwrite the file, instead of updating the buffer | 0 | optional |
|
||||||
| `stdin` | send data to the stdin of the formatter | 0 | optional |
|
| `stdin` | send data to the stdin of the formatter | 0 | optional |
|
||||||
| `stderr` | capture stderr output from formatter | 0 | optional |
|
| `stderr` | capture stderr output from formatter | 0 | optional |
|
||||||
| `no_append` | do not append the `path` of the file to the formatter command, used when the `path` is in the middle of a command | 0 | optional |
|
| `no_append` | do not append the `path` of the file to the formatter command, used when the `path` is in the middle of a command | 0 | optional |
|
||||||
| `env` | list of environment variable definitions to be prepended to the formatter command | \[] | optional |
|
| `env` | list of environment variable definitions to be prepended to the formatter command | \[] | optional |
|
||||||
| `valid_exit_codes` | list of valid exit codes for formatters who do not respect common unix practices | \[0] | optional |
|
| `valid_exit_codes` | list of valid exit codes for formatters who do not respect common unix practices | \[0] | optional |
|
||||||
|
| `try_node_exe` | attempt to find `exe` in a `node_modules/.bin` directory in the current working directory or one of its parents (requires setting `g:neoformat_try_node_exe`) | 0 | optional |
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
@ -155,6 +158,14 @@ let g:neoformat_verbose = 1 " only affects the verbosity of Neoformat
|
|||||||
let &verbose = 1 " also increases verbosity of the editor as a whole
|
let &verbose = 1 " also increases verbosity of the editor as a whole
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Have Neoformat look for a formatter executable in the `node_modules/.bin`
|
||||||
|
directory in the current working directory or one of its parents (only applies
|
||||||
|
to formatters with `try_node_exe` set to `1`):
|
||||||
|
|
||||||
|
```viml
|
||||||
|
let g:neoformat_try_node_exe = 1
|
||||||
|
```
|
||||||
|
|
||||||
## Adding a New Formatter
|
## Adding a New Formatter
|
||||||
|
|
||||||
Note: you should replace everything `{{ }}` accordingly
|
Note: you should replace everything `{{ }}` accordingly
|
||||||
@ -247,15 +258,23 @@ that caused Neoformat to be invoked.
|
|||||||
[`prettier`](https://github.com/prettier/prettier)
|
[`prettier`](https://github.com/prettier/prettier)
|
||||||
- CSV
|
- CSV
|
||||||
- [`prettydiff`](https://github.com/prettydiff/prettydiff)
|
- [`prettydiff`](https://github.com/prettydiff/prettydiff)
|
||||||
|
- Cue
|
||||||
|
- [`cue fmt`](https://cuelang.org/)
|
||||||
- D
|
- D
|
||||||
- [`uncrustify`](http://uncrustify.sourceforge.net),
|
- [`uncrustify`](http://uncrustify.sourceforge.net),
|
||||||
[`dfmt`](https://github.com/Hackerpilot/dfmt)
|
[`dfmt`](https://github.com/Hackerpilot/dfmt)
|
||||||
- Dart
|
- Dart
|
||||||
- [`dartfmt`](https://www.dartlang.org/tools/)
|
- [`dartfmt`](https://www.dartlang.org/tools/)
|
||||||
|
- [`dart format`](https://dart.dev/tools/dart-format)
|
||||||
- Dhall
|
- Dhall
|
||||||
- [`dhall format`](https://dhall-lang.org)
|
- [`dhall format`](https://dhall-lang.org)
|
||||||
- dune
|
- dune
|
||||||
- [`dune format`](https://github.com/ocaml/dune)
|
- [`dune format`](https://github.com/ocaml/dune)
|
||||||
|
- Ebuild
|
||||||
|
- [`shfmt`](https://github.com/mvdan/sh)
|
||||||
|
```vim
|
||||||
|
let g:shfmt_opt="-ci"
|
||||||
|
```
|
||||||
- Elixir
|
- Elixir
|
||||||
- [`mix format`](https://hexdocs.pm/mix/master/Mix.Tasks.Format.html)
|
- [`mix format`](https://hexdocs.pm/mix/master/Mix.Tasks.Format.html)
|
||||||
- Elm
|
- Elm
|
||||||
@ -264,6 +283,8 @@ that caused Neoformat to be invoked.
|
|||||||
- [`erlfmt`](https://github.com/WhatsApp/erlfmt)
|
- [`erlfmt`](https://github.com/WhatsApp/erlfmt)
|
||||||
- Fish
|
- Fish
|
||||||
- [`fish_indent`](http://fishshell.com)
|
- [`fish_indent`](http://fishshell.com)
|
||||||
|
- Fortran
|
||||||
|
- [`fprettify`](https://github.com/pseewald/fprettify)
|
||||||
- F#
|
- F#
|
||||||
- [`fantomas`](https://github.com/fsprojects/fantomas)
|
- [`fantomas`](https://github.com/fsprojects/fantomas)
|
||||||
- GDScript
|
- GDScript
|
||||||
@ -297,9 +318,12 @@ that caused Neoformat to be invoked.
|
|||||||
" wrong
|
" wrong
|
||||||
let g:neoformat_enabled_haskell = ['sort-imports', 'stylish-haskell']
|
let g:neoformat_enabled_haskell = ['sort-imports', 'stylish-haskell']
|
||||||
```
|
```
|
||||||
|
- Toml
|
||||||
|
- [`taplo`](https://taplo.tamasfe.dev/cli)
|
||||||
- Puppet
|
- Puppet
|
||||||
- [`puppet-lint`](https://github.com/rodjek/puppet-lint)
|
- [`puppet-lint`](https://github.com/rodjek/puppet-lint)
|
||||||
- PureScript
|
- PureScript
|
||||||
|
- [`purs-tidy`](https://github.com/natefaubion/purescript-tidy)
|
||||||
- [`purty`](https://gitlab.com/joneshf/purty)
|
- [`purty`](https://gitlab.com/joneshf/purty)
|
||||||
- HTML
|
- HTML
|
||||||
- `html-beautify` (ships with [`js-beautify`](https://github.com/beautify-web/js-beautify)),
|
- `html-beautify` (ships with [`js-beautify`](https://github.com/beautify-web/js-beautify)),
|
||||||
@ -321,13 +345,17 @@ that caused Neoformat to be invoked.
|
|||||||
[`eslint_d`](https://github.com/mantoni/eslint_d.js),
|
[`eslint_d`](https://github.com/mantoni/eslint_d.js),
|
||||||
[`standard`](https://standardjs.com/),
|
[`standard`](https://standardjs.com/),
|
||||||
[`semistandard`](https://github.com/standard/semistandard),
|
[`semistandard`](https://github.com/standard/semistandard),
|
||||||
[`deno fmt`](https://deno.land/manual/tools/formatter),
|
[`deno fmt`](https://deno.land/manual/tools/formatter)
|
||||||
- JSON
|
- JSON
|
||||||
- [`js-beautify`](https://github.com/beautify-web/js-beautify),
|
- [`js-beautify`](https://github.com/beautify-web/js-beautify),
|
||||||
[`prettydiff`](https://github.com/prettydiff/prettydiff),
|
[`prettydiff`](https://github.com/prettydiff/prettydiff),
|
||||||
[`prettier`](https://github.com/prettier/prettier),
|
[`prettier`](https://github.com/prettier/prettier),
|
||||||
[`jq`](https://stedolan.github.io/jq/),
|
[`jq`](https://stedolan.github.io/jq/),
|
||||||
[`fixjson`](https://github.com/rhysd/fixjson)
|
[`fixjson`](https://github.com/rhysd/fixjson)
|
||||||
|
[`deno fmt`](https://deno.land/manual/tools/formatter)
|
||||||
|
- JSONC (JSON with comments)
|
||||||
|
- [`prettier`](https://github.com/prettier/prettier)
|
||||||
|
[`deno fmt`](https://deno.land/manual/tools/formatter)
|
||||||
- Kotlin
|
- Kotlin
|
||||||
- [`ktlint`](https://github.com/shyiko/ktlint),
|
- [`ktlint`](https://github.com/shyiko/ktlint),
|
||||||
[`prettier`](https://github.com/prettier/prettier)
|
[`prettier`](https://github.com/prettier/prettier)
|
||||||
@ -342,9 +370,11 @@ that caused Neoformat to be invoked.
|
|||||||
- [`luaformatter`](https://github.com/LuaDevelopmentTools/luaformatter)
|
- [`luaformatter`](https://github.com/LuaDevelopmentTools/luaformatter)
|
||||||
- [`lua-fmt`](https://github.com/trixnz/lua-fmt)
|
- [`lua-fmt`](https://github.com/trixnz/lua-fmt)
|
||||||
- [`lua-format`](https://github.com/Koihik/LuaFormatter)
|
- [`lua-format`](https://github.com/Koihik/LuaFormatter)
|
||||||
|
- [`stylua`](https://github.com/JohnnyMorganz/StyLua)
|
||||||
- Markdown
|
- Markdown
|
||||||
- [`remark`](https://github.com/wooorm/remark)
|
- [`remark`](https://github.com/wooorm/remark)
|
||||||
[`prettier`](https://github.com/prettier/prettier)
|
[`prettier`](https://github.com/prettier/prettier)
|
||||||
|
[`deno fmt`](https://deno.land/manual/tools/formatter)
|
||||||
- Matlab
|
- Matlab
|
||||||
- [`matlab-formatter-vscode`](https://github.com/affenwiesel/matlab-formatter-vscode)
|
- [`matlab-formatter-vscode`](https://github.com/affenwiesel/matlab-formatter-vscode)
|
||||||
- Nginx
|
- Nginx
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
" Set global flag to allow checking in custom user config
|
||||||
|
let g:neoformat = 1
|
||||||
|
|
||||||
function! neoformat#Neoformat(bang, user_input, start_line, end_line) abort
|
function! neoformat#Neoformat(bang, user_input, start_line, end_line) abort
|
||||||
let view = winsaveview()
|
let view = winsaveview()
|
||||||
let search = @/
|
let search = @/
|
||||||
@ -141,10 +144,10 @@ function! s:neoformat(bang, user_input, start_line, end_line) abort
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
if len(formatters_failed) > 0
|
if len(formatters_failed) > 0
|
||||||
call neoformat#utils#msg('formatters ' . join(formatters_failed, ', ') . ' failed to run')
|
call neoformat#utils#msg('formatters ' . join(formatters_failed, ", ") . ' failed to run')
|
||||||
endif
|
endif
|
||||||
if len(formatters_changed) > 0
|
if len(formatters_changed) > 0
|
||||||
call neoformat#utils#msg(join(formatters_changed, ', ') . ' formatted buffer')
|
call neoformat#utils#msg(join(formatters_changed, ", ") . ' formatted buffer')
|
||||||
elseif len(formatters_failed) == 0
|
elseif len(formatters_failed) == 0
|
||||||
call neoformat#utils#msg('no change necessary')
|
call neoformat#utils#msg('no change necessary')
|
||||||
endif
|
endif
|
||||||
@ -196,7 +199,7 @@ function! neoformat#CompleteFormatters(ArgLead, CmdLine, CursorPos) abort
|
|||||||
\ "fnamemodify(v:val, ':t:r')"))),
|
\ "fnamemodify(v:val, ':t:r')"))),
|
||||||
\ "v:val =~? '^" . a:ArgLead . "'")
|
\ "v:val =~? '^" . a:ArgLead . "'")
|
||||||
endif
|
endif
|
||||||
if a:ArgLead =~# '[^A-Za-z0-9]'
|
if a:ArgLead =~ '[^A-Za-z0-9]'
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
let filetype = s:split_filetypes(&filetype)
|
let filetype = s:split_filetypes(&filetype)
|
||||||
@ -220,6 +223,15 @@ function! s:split_filetypes(filetype) abort
|
|||||||
return split(a:filetype, '\.')[0]
|
return split(a:filetype, '\.')[0]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:get_node_exe(exe) abort
|
||||||
|
let node_exe = findfile('node_modules/.bin/' . a:exe, getcwd() . ';')
|
||||||
|
if !empty(node_exe) && executable(node_exe)
|
||||||
|
return node_exe
|
||||||
|
endif
|
||||||
|
|
||||||
|
return a:exe
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:generate_cmd(definition, filetype) abort
|
function! s:generate_cmd(definition, filetype) abort
|
||||||
let executable = get(a:definition, 'exe', '')
|
let executable = get(a:definition, 'exe', '')
|
||||||
if executable == ''
|
if executable == ''
|
||||||
@ -227,8 +239,14 @@ function! s:generate_cmd(definition, filetype) abort
|
|||||||
return {}
|
return {}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if &shell =~# '\v%(powershell|pwsh)'
|
if exists('g:neoformat_try_node_exe')
|
||||||
if system('[bool](Get-Command ' . executable . ' -ErrorAction SilentlyContinue)') !~# 'True'
|
\ && g:neoformat_try_node_exe
|
||||||
|
\ && get(a:definition, 'try_node_exe', 0)
|
||||||
|
let executable = s:get_node_exe(executable)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if &shell =~ '\v%(powershell|pwsh)'
|
||||||
|
if system('[bool](Get-Command ' . executable . ' -ErrorAction SilentlyContinue)') !~ 'True'
|
||||||
call neoformat#utils#log('executable: ' . executable . ' is not a cmdlet, function, script file, or an executable program')
|
call neoformat#utils#log('executable: ' . executable . ' is not a cmdlet, function, script file, or an executable program')
|
||||||
return {}
|
return {}
|
||||||
endif
|
endif
|
||||||
@ -250,8 +268,8 @@ function! s:generate_cmd(definition, filetype) abort
|
|||||||
|
|
||||||
let filename = expand('%:t')
|
let filename = expand('%:t')
|
||||||
|
|
||||||
let tmp_dir = has('win32') ? expand('$TEMP/neoformat', 1) :
|
let tmp_dir = has('win32') ? expand('$TEMP/neoformat') :
|
||||||
\ exists('$TMPDIR') ? expand('$TMPDIR/neoformat', 1) :
|
\ exists('$TMPDIR') ? expand('$TMPDIR/neoformat') :
|
||||||
\ '/tmp/neoformat'
|
\ '/tmp/neoformat'
|
||||||
|
|
||||||
if !isdirectory(tmp_dir)
|
if !isdirectory(tmp_dir)
|
||||||
@ -259,7 +277,7 @@ function! s:generate_cmd(definition, filetype) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if get(a:definition, 'replace', 0)
|
if get(a:definition, 'replace', 0)
|
||||||
let path = !using_stdin ? expand(tmp_dir . '/' . fnameescape(filename), 1) : ''
|
let path = !using_stdin ? expand(tmp_dir . '/' . fnameescape(filename)) : ''
|
||||||
else
|
else
|
||||||
let path = !using_stdin ? tempname() : ''
|
let path = !using_stdin ? tempname() : ''
|
||||||
endif
|
endif
|
||||||
|
@ -5,6 +5,8 @@ endfunction
|
|||||||
function! neoformat#formatters#bzl#buildifier() abort
|
function! neoformat#formatters#bzl#buildifier() abort
|
||||||
return {
|
return {
|
||||||
\ 'exe': 'buildifier',
|
\ 'exe': 'buildifier',
|
||||||
\ 'stdin': 1
|
\ 'args': ['-path', expand('%:p')],
|
||||||
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -4,6 +4,8 @@ endfunction
|
|||||||
|
|
||||||
function! neoformat#formatters#cmake#cmakeformat() abort
|
function! neoformat#formatters#cmake#cmakeformat() abort
|
||||||
return {
|
return {
|
||||||
\ 'exe': 'cmake-format'
|
\ 'exe': 'cmake-format',
|
||||||
|
\ 'args': ['-'],
|
||||||
|
\ 'stdin': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -13,7 +13,8 @@ endfunction
|
|||||||
function! neoformat#formatters#css#csscomb() abort
|
function! neoformat#formatters#css#csscomb() abort
|
||||||
return {
|
return {
|
||||||
\ 'exe': 'csscomb',
|
\ 'exe': 'csscomb',
|
||||||
\ 'replace': 1
|
\ 'replace': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ function! neoformat#formatters#css#stylefmt() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'stylefmt',
|
\ 'exe': 'stylefmt',
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -41,7 +43,8 @@ function! neoformat#formatters#css#prettier() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'prettier',
|
\ 'exe': 'prettier',
|
||||||
\ 'args': ['--stdin-filepath', '"%:p"', '--parser', 'css'],
|
\ 'args': ['--stdin-filepath', '"%:p"', '--parser', 'css'],
|
||||||
\ 'stdin': 1
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -50,5 +53,6 @@ function! neoformat#formatters#css#stylelint() abort
|
|||||||
\ 'exe': 'stylelint',
|
\ 'exe': 'stylelint',
|
||||||
\ 'args': ['--fix', '--stdin-filename', '"%:t"'],
|
\ 'args': ['--fix', '--stdin-filename', '"%:t"'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
11
bundle/neoformat/autoload/neoformat/formatters/cue.vim
Normal file
11
bundle/neoformat/autoload/neoformat/formatters/cue.vim
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
function! neoformat#formatters#cue#enabled() abort
|
||||||
|
return ['cue']
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! neoformat#formatters#cue#cue() abort
|
||||||
|
return {
|
||||||
|
\ 'exe': 'cue',
|
||||||
|
\ 'args': ['fmt', '-'],
|
||||||
|
\ 'stdin': 1
|
||||||
|
\ }
|
||||||
|
endfunction
|
@ -1,5 +1,5 @@
|
|||||||
function! neoformat#formatters#dart#enabled() abort
|
function! neoformat#formatters#dart#enabled() abort
|
||||||
return ['dartfmt']
|
return ['dartfmt', 'format']
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! neoformat#formatters#dart#dartfmt() abort
|
function! neoformat#formatters#dart#dartfmt() abort
|
||||||
@ -8,3 +8,11 @@ function! neoformat#formatters#dart#dartfmt() abort
|
|||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! neoformat#formatters#dart#format() abort
|
||||||
|
return {
|
||||||
|
\ 'exe': 'dart',
|
||||||
|
\ 'args': ['format'],
|
||||||
|
\ 'replace': 1,
|
||||||
|
\ }
|
||||||
|
endfunction
|
||||||
|
13
bundle/neoformat/autoload/neoformat/formatters/ebuild.vim
Normal file
13
bundle/neoformat/autoload/neoformat/formatters/ebuild.vim
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
function! neoformat#formatters#ebuild#enabled() abort
|
||||||
|
return ['shfmt']
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! neoformat#formatters#ebuild#shfmt() abort
|
||||||
|
let opts = get(g:, 'shfmt_opt', '')
|
||||||
|
|
||||||
|
return {
|
||||||
|
\ 'exe': 'shfmt',
|
||||||
|
\ 'args': ['-i ' . (&expandtab ? shiftwidth() : 0), opts],
|
||||||
|
\ 'stdin': 1,
|
||||||
|
\ }
|
||||||
|
endfunction
|
@ -7,5 +7,6 @@ function! neoformat#formatters#elm#elmformat() abort
|
|||||||
\ 'exe': 'elm-format',
|
\ 'exe': 'elm-format',
|
||||||
\ 'args': ['--stdin', '--elm-version=0.19'],
|
\ 'args': ['--stdin', '--elm-version=0.19'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
11
bundle/neoformat/autoload/neoformat/formatters/fortran.vim
Normal file
11
bundle/neoformat/autoload/neoformat/formatters/fortran.vim
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
function! neoformat#formatters#fortran#enabled() abort
|
||||||
|
return ['fprettify']
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! neoformat#formatters#fortran#fprettify() abort
|
||||||
|
return {
|
||||||
|
\ 'exe': 'fprettify',
|
||||||
|
\ 'args': ['--silent'],
|
||||||
|
\ 'stdin': 1
|
||||||
|
\ }
|
||||||
|
endfunction
|
@ -6,6 +6,7 @@ function! neoformat#formatters#graphql#prettier() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'prettier',
|
\ 'exe': 'prettier',
|
||||||
\ 'args': ['--stdin-filepath', '"%:p"', '--parser', 'graphql'],
|
\ 'args': ['--stdin-filepath', '"%:p"', '--parser', 'graphql'],
|
||||||
\ 'stdin': 1
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -11,7 +11,8 @@ function! neoformat#formatters#html#tidy() abort
|
|||||||
\ '--vertical-space yes',
|
\ '--vertical-space yes',
|
||||||
\ '--tidy-mark no',
|
\ '--tidy-mark no',
|
||||||
\ '-wrap ' . &textwidth
|
\ '-wrap ' . &textwidth
|
||||||
\ ]
|
\ ],
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ function! neoformat#formatters#html#prettier() abort
|
|||||||
\ 'exe': 'prettier',
|
\ 'exe': 'prettier',
|
||||||
\ 'args': ['--stdin-filepath', '"%:p"'],
|
\ 'args': ['--stdin-filepath', '"%:p"'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ function! neoformat#formatters#javascript#jsbeautify() abort
|
|||||||
\ 'exe': 'js-beautify',
|
\ 'exe': 'js-beautify',
|
||||||
\ 'args': ['--indent-size ' .shiftwidth()],
|
\ 'args': ['--indent-size ' .shiftwidth()],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -14,7 +15,8 @@ function! neoformat#formatters#javascript#clangformat() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'clang-format',
|
\ 'exe': 'clang-format',
|
||||||
\ 'args': ['-assume-filename=' . expand('%:t')],
|
\ 'args': ['-assume-filename=' . expand('%:t')],
|
||||||
\ 'stdin': 1
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -34,6 +36,7 @@ function! neoformat#formatters#javascript#esformatter() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'esformatter',
|
\ 'exe': 'esformatter',
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -42,6 +45,7 @@ function! neoformat#formatters#javascript#prettier() abort
|
|||||||
\ 'exe': 'prettier',
|
\ 'exe': 'prettier',
|
||||||
\ 'args': ['--stdin-filepath', '"%:p"'],
|
\ 'args': ['--stdin-filepath', '"%:p"'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -50,6 +54,7 @@ function! neoformat#formatters#javascript#prettiereslint() abort
|
|||||||
\ 'exe': 'prettier-eslint',
|
\ 'exe': 'prettier-eslint',
|
||||||
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"'],
|
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -58,6 +63,7 @@ function! neoformat#formatters#javascript#eslint_d() abort
|
|||||||
\ 'exe': 'eslint_d',
|
\ 'exe': 'eslint_d',
|
||||||
\ 'args': ['--stdin', '--stdin-filename', '"%:p"', '--fix-to-stdout'],
|
\ 'args': ['--stdin', '--stdin-filename', '"%:p"', '--fix-to-stdout'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -66,6 +72,7 @@ function! neoformat#formatters#javascript#standard() abort
|
|||||||
\ 'exe': 'standard',
|
\ 'exe': 'standard',
|
||||||
\ 'args': ['--stdin','--fix'],
|
\ 'args': ['--stdin','--fix'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -82,5 +89,6 @@ function! neoformat#formatters#javascript#semistandard() abort
|
|||||||
\ 'exe': 'semistandard',
|
\ 'exe': 'semistandard',
|
||||||
\ 'args': ['--stdin','--fix'],
|
\ 'args': ['--stdin','--fix'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -7,6 +7,7 @@ function! neoformat#formatters#javascriptreact#jsbeautify() abort
|
|||||||
\ 'exe': 'js-beautify',
|
\ 'exe': 'js-beautify',
|
||||||
\ 'args': ['--indent-size ' .shiftwidth()],
|
\ 'args': ['--indent-size ' .shiftwidth()],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -26,6 +27,7 @@ function! neoformat#formatters#javascriptreact#esformatter() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'esformatter',
|
\ 'exe': 'esformatter',
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -34,6 +36,7 @@ function! neoformat#formatters#javascriptreact#prettier() abort
|
|||||||
\ 'exe': 'prettier',
|
\ 'exe': 'prettier',
|
||||||
\ 'args': ['--stdin-filepath', '"%:p"'],
|
\ 'args': ['--stdin-filepath', '"%:p"'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -42,6 +45,7 @@ function! neoformat#formatters#javascriptreact#prettiereslint() abort
|
|||||||
\ 'exe': 'prettier-eslint',
|
\ 'exe': 'prettier-eslint',
|
||||||
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"'],
|
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -50,6 +54,7 @@ function! neoformat#formatters#javascriptreact#eslint_d() abort
|
|||||||
\ 'exe': 'eslint_d',
|
\ 'exe': 'eslint_d',
|
||||||
\ 'args': ['--stdin', '--stdin-filename', '"%:p"', '--fix-to-stdout'],
|
\ 'args': ['--stdin', '--stdin-filename', '"%:p"', '--fix-to-stdout'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -58,6 +63,7 @@ function! neoformat#formatters#javascriptreact#standard() abort
|
|||||||
\ 'exe': 'standard',
|
\ 'exe': 'standard',
|
||||||
\ 'args': ['--stdin','--fix'],
|
\ 'args': ['--stdin','--fix'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -74,5 +80,6 @@ function! neoformat#formatters#javascriptreact#semistandard() abort
|
|||||||
\ 'exe': 'semistandard',
|
\ 'exe': 'semistandard',
|
||||||
\ 'args': ['--stdin','--fix'],
|
\ 'args': ['--stdin','--fix'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function! neoformat#formatters#json#enabled() abort
|
function! neoformat#formatters#json#enabled() abort
|
||||||
return ['jsbeautify', 'prettydiff', 'prettier', 'jq', 'fixjson']
|
return ['jsbeautify', 'prettydiff', 'prettier', 'jq', 'fixjson', 'denofmt']
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! neoformat#formatters#json#jsbeautify() abort
|
function! neoformat#formatters#json#jsbeautify() abort
|
||||||
@ -20,8 +20,9 @@ endfunction
|
|||||||
function! neoformat#formatters#json#prettier() abort
|
function! neoformat#formatters#json#prettier() abort
|
||||||
return {
|
return {
|
||||||
\ 'exe': 'prettier',
|
\ 'exe': 'prettier',
|
||||||
\ 'args': ['--stdin-filepath', '"%:p"', '--parser', 'json'],
|
\ 'args': ['--stdin-filepath', '"%:p"'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -31,5 +32,14 @@ function! neoformat#formatters#json#fixjson() abort
|
|||||||
\ 'exe': 'fixjson',
|
\ 'exe': 'fixjson',
|
||||||
\ 'args': ['--stdin-filename', l:filename],
|
\ 'args': ['--stdin-filename', l:filename],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
|
\ }
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! neoformat#formatters#json#denofmt() abort
|
||||||
|
return {
|
||||||
|
\ 'exe': 'deno',
|
||||||
|
\ 'args': ['fmt','-'],
|
||||||
|
\ 'stdin': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
20
bundle/neoformat/autoload/neoformat/formatters/jsonc.vim
Normal file
20
bundle/neoformat/autoload/neoformat/formatters/jsonc.vim
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
function! neoformat#formatters#jsonc#enabled() abort
|
||||||
|
return ['prettier', 'denofmt']
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! neoformat#formatters#jsonc#prettier() abort
|
||||||
|
return {
|
||||||
|
\ 'exe': 'prettier',
|
||||||
|
\ 'args': ['--stdin-filepath', '"%:p"'],
|
||||||
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
|
\ }
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! neoformat#formatters#jsonc#denofmt() abort
|
||||||
|
return {
|
||||||
|
\ 'exe': 'deno',
|
||||||
|
\ 'args': ['fmt','-'],
|
||||||
|
\ 'stdin': 1,
|
||||||
|
\ }
|
||||||
|
endfunction
|
@ -1,5 +1,5 @@
|
|||||||
function! neoformat#formatters#lua#enabled() abort
|
function! neoformat#formatters#lua#enabled() abort
|
||||||
return ['luaformatter', 'luafmt', 'luaformat']
|
return ['luaformatter', 'luafmt', 'luaformat', 'stylua']
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! neoformat#formatters#lua#luaformatter() abort
|
function! neoformat#formatters#lua#luaformatter() abort
|
||||||
@ -21,3 +21,11 @@ function! neoformat#formatters#lua#luaformat() abort
|
|||||||
\ 'exe': 'lua-format'
|
\ 'exe': 'lua-format'
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! neoformat#formatters#lua#stylua() abort
|
||||||
|
return {
|
||||||
|
\ 'exe': 'stylua',
|
||||||
|
\ 'args': ['--search-parent-directories', '--stdin-filepath', '"%:p"', '--', '-'],
|
||||||
|
\ 'stdin': 1,
|
||||||
|
\ }
|
||||||
|
endfunction
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
function! neoformat#formatters#markdown#enabled() abort
|
function! neoformat#formatters#markdown#enabled() abort
|
||||||
return ['remark', 'prettier']
|
return ['remark', 'prettier', 'denofmt']
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! neoformat#formatters#markdown#prettier() abort
|
function! neoformat#formatters#markdown#prettier() abort
|
||||||
@ -7,6 +7,7 @@ function! neoformat#formatters#markdown#prettier() abort
|
|||||||
\ 'exe': 'prettier',
|
\ 'exe': 'prettier',
|
||||||
\ 'args': ['--stdin-filepath', '"%:p"'],
|
\ 'args': ['--stdin-filepath', '"%:p"'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -15,5 +16,14 @@ function! neoformat#formatters#markdown#remark() abort
|
|||||||
\ 'exe': 'remark',
|
\ 'exe': 'remark',
|
||||||
\ 'args': ['--no-color', '--silent'],
|
\ 'args': ['--no-color', '--silent'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! neoformat#formatters#markdown#denofmt() abort
|
||||||
|
return {
|
||||||
|
\ 'exe': 'deno',
|
||||||
|
\ 'args': ['fmt','-'],
|
||||||
|
\ 'stdin': 1,
|
||||||
|
\ }
|
||||||
|
endfunction
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
function! neoformat#formatters#purescript#enabled() abort
|
function! neoformat#formatters#purescript#enabled() abort
|
||||||
return ['purty']
|
return ['purstidy', 'purty']
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! neoformat#formatters#purescript#purstidy() abort
|
||||||
|
return {
|
||||||
|
\ 'exe': 'purs-tidy',
|
||||||
|
\ 'args': ['format'],
|
||||||
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! neoformat#formatters#purescript#purty() abort
|
function! neoformat#formatters#purescript#purty() abort
|
||||||
@ -7,5 +16,6 @@ function! neoformat#formatters#purescript#purty() abort
|
|||||||
\ 'exe': 'purty',
|
\ 'exe': 'purty',
|
||||||
\ 'args': ['-'],
|
\ 'args': ['-'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -7,6 +7,7 @@ function! neoformat#formatters#reason#refmt() abort
|
|||||||
\ 'exe': 'refmt',
|
\ 'exe': 'refmt',
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
\ 'args': ["--interface=" . (expand('%:e') == "rei" ? "true" : "false")],
|
\ 'args': ["--interface=" . (expand('%:e') == "rei" ? "true" : "false")],
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -5,10 +5,6 @@ endfunction
|
|||||||
function! neoformat#formatters#rust#rustfmt() abort
|
function! neoformat#formatters#rust#rustfmt() abort
|
||||||
return {
|
return {
|
||||||
\ 'exe': 'rustfmt',
|
\ 'exe': 'rustfmt',
|
||||||
\ 'args': ['--config hard_tabs=' . (&expandtab ? 'false' : 'true') .
|
|
||||||
\ ',tab_spaces=' . shiftwidth() .
|
|
||||||
\ ',max_width=' . &textwidth
|
|
||||||
\ ],
|
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -7,6 +7,7 @@ function! neoformat#formatters#sass#sassconvert() abort
|
|||||||
\ 'exe': 'sass-convert',
|
\ 'exe': 'sass-convert',
|
||||||
\ 'args': ['-F sass', '-T sass', '-s'],
|
\ 'args': ['-F sass', '-T sass', '-s'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ function! neoformat#formatters#scss#sassconvert() abort
|
|||||||
\ 'exe': 'sass-convert',
|
\ 'exe': 'sass-convert',
|
||||||
\ 'args': ['-F scss', '-T scss', '--indent ' . (&expandtab ? shiftwidth() : 't')],
|
\ 'args': ['-F scss', '-T scss', '--indent ' . (&expandtab ? shiftwidth() : 't')],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -4,7 +4,9 @@ endfunction
|
|||||||
|
|
||||||
function! neoformat#formatters#starlark#buildifier() abort
|
function! neoformat#formatters#starlark#buildifier() abort
|
||||||
return {
|
return {
|
||||||
\ 'exe': 'buildifier',
|
\ 'exe': 'buildifier',
|
||||||
\ 'stdin': 1
|
\ 'args': ['-path', expand('%:p')],
|
||||||
\ }
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -5,7 +5,8 @@ endfunction
|
|||||||
function! neoformat#formatters#svelte#prettier() abort
|
function! neoformat#formatters#svelte#prettier() abort
|
||||||
return {
|
return {
|
||||||
\ 'exe': 'prettier',
|
\ 'exe': 'prettier',
|
||||||
\ 'args': ['--stdin-filepath', '--parser=svelte', '--plugin-search-dir=.', '"%:p"'],
|
\ 'args': ['--stdin-filepath', '"%:p"', '--parser=svelte', '--plugin-search-dir=.'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -5,7 +5,7 @@ endfunction
|
|||||||
function! neoformat#formatters#tex#latexindent() abort
|
function! neoformat#formatters#tex#latexindent() abort
|
||||||
return {
|
return {
|
||||||
\ 'exe': 'latexindent',
|
\ 'exe': 'latexindent',
|
||||||
\ 'args': ['-sl', '-g /dev/stderr', '2>/dev/null'],
|
\ 'args': ['-g /dev/stderr', '2>/dev/null'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
11
bundle/neoformat/autoload/neoformat/formatters/tf.vim
Normal file
11
bundle/neoformat/autoload/neoformat/formatters/tf.vim
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
function! neoformat#formatters#tf() abort
|
||||||
|
return ['tf']
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! neoformat#formatters#tfm#tf() abort
|
||||||
|
return {
|
||||||
|
\ 'exe': 'terraform',
|
||||||
|
\ 'args': ['fmt', '-write', '-'],
|
||||||
|
\ 'stdin': 1
|
||||||
|
\ }
|
||||||
|
endfunction
|
12
bundle/neoformat/autoload/neoformat/formatters/toml.vim
Normal file
12
bundle/neoformat/autoload/neoformat/formatters/toml.vim
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
function! neoformat#formatters#toml#enabled() abort
|
||||||
|
return ['taplo']
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! neoformat#formatters#toml#taplo() abort
|
||||||
|
return {
|
||||||
|
\ 'exe': 'taplo',
|
||||||
|
\ 'args': ['fmt', '-'],
|
||||||
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
|
\ }
|
||||||
|
endfunction
|
@ -6,7 +6,8 @@ function! neoformat#formatters#typescript#tsfmt() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'tsfmt',
|
\ 'exe': 'tsfmt',
|
||||||
\ 'args': ['--replace', '--baseDir=%:h'],
|
\ 'args': ['--replace', '--baseDir=%:h'],
|
||||||
\ 'replace': 1
|
\ 'replace': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -14,7 +15,8 @@ function! neoformat#formatters#typescript#prettier() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'prettier',
|
\ 'exe': 'prettier',
|
||||||
\ 'args': ['--stdin-filepath', '"%:p"', '--parser', 'typescript'],
|
\ 'args': ['--stdin-filepath', '"%:p"', '--parser', 'typescript'],
|
||||||
\ 'stdin': 1
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -23,6 +25,7 @@ function! neoformat#formatters#typescript#prettiereslint() abort
|
|||||||
\ 'exe': 'prettier-eslint',
|
\ 'exe': 'prettier-eslint',
|
||||||
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"', '--parser', 'typescript'],
|
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"', '--parser', 'typescript'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -36,7 +39,8 @@ function! neoformat#formatters#typescript#tslint() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'tslint',
|
\ 'exe': 'tslint',
|
||||||
\ 'args': args,
|
\ 'args': args,
|
||||||
\ 'replace': 1
|
\ 'replace': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -45,6 +49,7 @@ function! neoformat#formatters#typescript#eslint_d() abort
|
|||||||
\ 'exe': 'eslint_d',
|
\ 'exe': 'eslint_d',
|
||||||
\ 'args': ['--stdin', '--stdin-filename', '"%:p"', '--fix-to-stdout'],
|
\ 'args': ['--stdin', '--stdin-filename', '"%:p"', '--fix-to-stdout'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -52,7 +57,8 @@ function! neoformat#formatters#typescript#clangformat() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'clang-format',
|
\ 'exe': 'clang-format',
|
||||||
\ 'args': ['-assume-filename=' . expand('%:t')],
|
\ 'args': ['-assume-filename=' . expand('%:t')],
|
||||||
\ 'stdin': 1
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -6,7 +6,8 @@ function! neoformat#formatters#typescriptreact#tsfmt() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'tsfmt',
|
\ 'exe': 'tsfmt',
|
||||||
\ 'args': ['--replace', '--baseDir=%:h'],
|
\ 'args': ['--replace', '--baseDir=%:h'],
|
||||||
\ 'replace': 1
|
\ 'replace': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -14,7 +15,8 @@ function! neoformat#formatters#typescriptreact#prettier() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'prettier',
|
\ 'exe': 'prettier',
|
||||||
\ 'args': ['--stdin-filepath', '"%:p"', '--parser', 'typescript'],
|
\ 'args': ['--stdin-filepath', '"%:p"', '--parser', 'typescript'],
|
||||||
\ 'stdin': 1
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -23,6 +25,7 @@ function! neoformat#formatters#typescriptreact#prettiereslint() abort
|
|||||||
\ 'exe': 'prettier-eslint',
|
\ 'exe': 'prettier-eslint',
|
||||||
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"', '--parser', 'typescript'],
|
\ 'args': ['--stdin', '--stdin-filepath', '"%:p"', '--parser', 'typescript'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -36,7 +39,8 @@ function! neoformat#formatters#typescriptreact#tslint() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'tslint',
|
\ 'exe': 'tslint',
|
||||||
\ 'args': args,
|
\ 'args': args,
|
||||||
\ 'replace': 1
|
\ 'replace': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -45,6 +49,7 @@ function! neoformat#formatters#typescriptreact#eslint_d() abort
|
|||||||
\ 'exe': 'eslint_d',
|
\ 'exe': 'eslint_d',
|
||||||
\ 'args': ['--stdin', '--stdin-filename', '"%:p"', '--fix-to-stdout'],
|
\ 'args': ['--stdin', '--stdin-filename', '"%:p"', '--fix-to-stdout'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -52,7 +57,8 @@ function! neoformat#formatters#typescriptreact#clangformat() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'clang-format',
|
\ 'exe': 'clang-format',
|
||||||
\ 'args': ['-assume-filename=' . expand('%:t')],
|
\ 'args': ['-assume-filename=' . expand('%:t')],
|
||||||
\ 'stdin': 1
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ function! neoformat#formatters#vue#prettier() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'prettier',
|
\ 'exe': 'prettier',
|
||||||
\ 'args': ['--stdin-filepath', '"%:p"', '--parser', 'vue'],
|
\ 'args': ['--stdin-filepath', '"%:p"', '--parser', 'vue'],
|
||||||
\ 'stdin': 1
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -13,6 +13,7 @@ function! neoformat#formatters#xhtml#tidy() abort
|
|||||||
\ '--tidy-mark no'
|
\ '--tidy-mark no'
|
||||||
\ ],
|
\ ],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ function! neoformat#formatters#xml#tidy() abort
|
|||||||
\ '--tidy-mark no'
|
\ '--tidy-mark no'
|
||||||
\ ],
|
\ ],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ function! neoformat#formatters#xml#prettier() abort
|
|||||||
\ 'exe': 'prettier',
|
\ 'exe': 'prettier',
|
||||||
\ 'args': ['--stdin-filepath', '"%:p"'],
|
\ 'args': ['--stdin-filepath', '"%:p"'],
|
||||||
\ 'stdin': 1,
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ function! neoformat#formatters#yaml#prettier() abort
|
|||||||
return {
|
return {
|
||||||
\ 'exe': 'prettier',
|
\ 'exe': 'prettier',
|
||||||
\ 'args': ['--stdin-filepath', '"%:p"', '--parser', 'yaml'],
|
\ 'args': ['--stdin-filepath', '"%:p"', '--parser', 'yaml'],
|
||||||
\ 'stdin': 1
|
\ 'stdin': 1,
|
||||||
|
\ 'try_node_exe': 1,
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -98,6 +98,7 @@ Options:
|
|||||||
| `env` | list of environment variables to prepend to the command | default: [] | optional
|
| `env` | list of environment variables to prepend to the command | default: [] | optional
|
||||||
|
|
||||||
| `valid_exit_codes` | list of valid exit codes for formatters who do not respect common unix practices | \[0] | optional
|
| `valid_exit_codes` | list of valid exit codes for formatters who do not respect common unix practices | \[0] | optional
|
||||||
|
| `try_node_exe` | attempt to find `exe` in a `node_modules/.bin` directory in the current working directory or one of its parents (requires setting `g:neoformat_try_node_exe`) | default: 0 | optional
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
@ -150,6 +151,13 @@ When debugging, you can enable either of following variables for extra logging.
|
|||||||
" Or
|
" Or
|
||||||
let &verbose = 1 " also increases verbosity of the editor as a whole
|
let &verbose = 1 " also increases verbosity of the editor as a whole
|
||||||
<
|
<
|
||||||
|
Have Neoformat look for a formatter executable in the `node_modules/.bin`
|
||||||
|
directory in the current working directory or one of its parents (only applies
|
||||||
|
to formatters with `try_node_exe` set to `1`):
|
||||||
|
>
|
||||||
|
let g:neoformat_try_node_exe = 1
|
||||||
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
ADDING A NEW FORMATTER *neoformat-adding-new-formatter*
|
ADDING A NEW FORMATTER *neoformat-adding-new-formatter*
|
||||||
|
|
||||||
@ -245,11 +253,14 @@ SUPPORTED FILETYPES *neoformat-supported-filetypes*
|
|||||||
[`csscomb`](http://csscomb.com)
|
[`csscomb`](http://csscomb.com)
|
||||||
- CSV
|
- CSV
|
||||||
- [`prettydiff`](https://github.com/prettydiff/prettydiff)
|
- [`prettydiff`](https://github.com/prettydiff/prettydiff)
|
||||||
|
- Cue
|
||||||
|
- [`cue fmt`](https://cuelang.org/)
|
||||||
- D
|
- D
|
||||||
- [`uncrustify`](http://uncrustify.sourceforge.net),
|
- [`uncrustify`](http://uncrustify.sourceforge.net),
|
||||||
[`dfmt`](https://github.com/Hackerpilot/dfmt)
|
[`dfmt`](https://github.com/Hackerpilot/dfmt)
|
||||||
- Dart
|
- Dart
|
||||||
- [`dartfmt`](https://www.dartlang.org/tools/)
|
- [`dartfmt`](https://www.dartlang.org/tools/)
|
||||||
|
- [`dart format`](https://dart.dev/tools/dart-format)
|
||||||
- Dhall
|
- Dhall
|
||||||
- [`dhall format`](https://dhall-lang.org)
|
- [`dhall format`](https://dhall-lang.org)
|
||||||
- dune
|
- dune
|
||||||
@ -262,6 +273,8 @@ SUPPORTED FILETYPES *neoformat-supported-filetypes*
|
|||||||
- [`erlfmt`](https://github.com/WhatsApp/erlfmt)
|
- [`erlfmt`](https://github.com/WhatsApp/erlfmt)
|
||||||
- Fish
|
- Fish
|
||||||
- [`fish_indent`](http://fishshell.com)
|
- [`fish_indent`](http://fishshell.com)
|
||||||
|
- Fortran
|
||||||
|
- [`fprettify`](https://github.com/pseewald/fprettify)
|
||||||
- F#
|
- F#
|
||||||
- [`fantomas`](https://github.com/fsprojects/fantomas)
|
- [`fantomas`](https://github.com/fsprojects/fantomas)
|
||||||
- GDScript
|
- GDScript
|
||||||
@ -294,6 +307,7 @@ SUPPORTED FILETYPES *neoformat-supported-filetypes*
|
|||||||
- Puppet
|
- Puppet
|
||||||
- [`puppet-lint`](https://github.com/rodjek/puppet-lint)
|
- [`puppet-lint`](https://github.com/rodjek/puppet-lint)
|
||||||
- PureScript
|
- PureScript
|
||||||
|
- [`purs-tidy`](https://github.com/natefaubion/purescript-tidy)
|
||||||
- [`purty`](https://gitlab.com/joneshf/purty)
|
- [`purty`](https://gitlab.com/joneshf/purty)
|
||||||
- HTML
|
- HTML
|
||||||
- `html-beautify` (ships with [`js-beautify`](https://github.com/beautify-web/js-beautify)),
|
- `html-beautify` (ships with [`js-beautify`](https://github.com/beautify-web/js-beautify)),
|
||||||
@ -322,6 +336,7 @@ SUPPORTED FILETYPES *neoformat-supported-filetypes*
|
|||||||
[`prettier`](https://github.com/prettier/prettier),
|
[`prettier`](https://github.com/prettier/prettier),
|
||||||
[`jq`](https://stedolan.github.io/jq/),
|
[`jq`](https://stedolan.github.io/jq/),
|
||||||
[`fixjson`](https://github.com/rhysd/fixjson)
|
[`fixjson`](https://github.com/rhysd/fixjson)
|
||||||
|
[`deno fmt`](https://deno.land/manual/tools/formatter)
|
||||||
- Kotlin
|
- Kotlin
|
||||||
- [`ktlint`](https://github.com/shyiko/ktlint)
|
- [`ktlint`](https://github.com/shyiko/ktlint)
|
||||||
[`prettier`](https://github.com/prettier/prettier)
|
[`prettier`](https://github.com/prettier/prettier)
|
||||||
@ -336,9 +351,11 @@ SUPPORTED FILETYPES *neoformat-supported-filetypes*
|
|||||||
- [`luaformatter`](https://github.com/LuaDevelopmentTools/luaformatter)
|
- [`luaformatter`](https://github.com/LuaDevelopmentTools/luaformatter)
|
||||||
- [`lua-fmt`](https://github.com/trixnz/lua-fmt)
|
- [`lua-fmt`](https://github.com/trixnz/lua-fmt)
|
||||||
- [`lua-format`](https://github.com/Koihik/LuaFormatter)
|
- [`lua-format`](https://github.com/Koihik/LuaFormatter)
|
||||||
|
- [`stylua`](https://github.com/JohnnyMorganz/StyLua)
|
||||||
- Markdown
|
- Markdown
|
||||||
- [`remark`](https://github.com/wooorm/remark)
|
- [`remark`](https://github.com/wooorm/remark)
|
||||||
[`prettier`](https://github.com/prettier/prettier),
|
[`prettier`](https://github.com/prettier/prettier),
|
||||||
|
[`deno fmt`](https://deno.land/manual/tools/formatter)
|
||||||
- Matlab
|
- Matlab
|
||||||
- [`matlab-formatter-vscode`](https://github.com/affenwiesel/matlab-formatter-vscode)
|
- [`matlab-formatter-vscode`](https://github.com/affenwiesel/matlab-formatter-vscode)
|
||||||
- Nginx
|
- Nginx
|
||||||
@ -430,6 +447,8 @@ SUPPORTED FILETYPES *neoformat-supported-filetypes*
|
|||||||
[`eslint_d`](https://github.com/mantoni/eslint_d.js)
|
[`eslint_d`](https://github.com/mantoni/eslint_d.js)
|
||||||
[`clang-format`](http://clang.llvm.org/docs/ClangFormat.html),
|
[`clang-format`](http://clang.llvm.org/docs/ClangFormat.html),
|
||||||
[`deno fmt`](https://deno.land/manual/tools/formatter)
|
[`deno fmt`](https://deno.land/manual/tools/formatter)
|
||||||
|
- Toml
|
||||||
|
- [`taplo`](https://taplo.tamasfe.dev/cli)
|
||||||
- V
|
- V
|
||||||
- `v fmt` (ships with [`v`](https://vlang.io))
|
- `v fmt` (ships with [`v`](https://vlang.io))
|
||||||
- VALA
|
- VALA
|
||||||
|
0
bundle/neoformat/test/bin/exit64
Normal file → Executable file
0
bundle/neoformat/test/bin/exit64
Normal file → Executable file
0
bundle/neoformat/test/install.sh
Normal file → Executable file
0
bundle/neoformat/test/install.sh
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user