mirror of
https://github.com/amix/vimrc
synced 2025-08-07 22:35:01 +08:00
Removed syntastic and replaced it with ale
Read more here: https://github.com/w0rp/ale
This commit is contained in:
26
sources_non_forked/ale/autoload/ale/fixers/autopep8.vim
Normal file
26
sources_non_forked/ale/autoload/ale/fixers/autopep8.vim
Normal file
@ -0,0 +1,26 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Fixing files with autopep8.
|
||||
|
||||
call ale#Set('python_autopep8_executable', 'autopep8')
|
||||
call ale#Set('python_autopep8_use_global', 0)
|
||||
call ale#Set('python_autopep8_options', '')
|
||||
|
||||
function! ale#fixers#autopep8#Fix(buffer) abort
|
||||
let l:executable = ale#python#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'python_autopep8',
|
||||
\ ['autopep8'],
|
||||
\)
|
||||
|
||||
if !executable(l:executable)
|
||||
return 0
|
||||
endif
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'python_autopep8_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -',
|
||||
\}
|
||||
endfunction
|
15
sources_non_forked/ale/autoload/ale/fixers/brittany.vim
Normal file
15
sources_non_forked/ale/autoload/ale/fixers/brittany.vim
Normal file
@ -0,0 +1,15 @@
|
||||
" Author: eborden <evan@evan-borden.com>
|
||||
" Description: Integration of brittany with ALE.
|
||||
|
||||
call ale#Set('haskell_brittany_executable', 'brittany')
|
||||
|
||||
function! ale#fixers#brittany#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'haskell_brittany_executable')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
|
22
sources_non_forked/ale/autoload/ale/fixers/clangformat.vim
Normal file
22
sources_non_forked/ale/autoload/ale/fixers/clangformat.vim
Normal file
@ -0,0 +1,22 @@
|
||||
scriptencoding utf-8
|
||||
" Author: Peter Renström <renstrom.peter@gmail.com>
|
||||
" Description: Fixing C/C++ files with clang-format.
|
||||
|
||||
call ale#Set('c_clangformat_executable', 'clang-format')
|
||||
call ale#Set('c_clangformat_use_global', 0)
|
||||
call ale#Set('c_clangformat_options', '')
|
||||
|
||||
function! ale#fixers#clangformat#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'c_clangformat', [
|
||||
\ 'clang-format',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#clangformat#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'c_clangformat_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#clangformat#GetExecutable(a:buffer))
|
||||
\ . ' ' . l:options,
|
||||
\}
|
||||
endfunction
|
23
sources_non_forked/ale/autoload/ale/fixers/elm_format.vim
Normal file
23
sources_non_forked/ale/autoload/ale/fixers/elm_format.vim
Normal file
@ -0,0 +1,23 @@
|
||||
" Author: soywod <clement.douin@gmail.com>
|
||||
" Description: Integration of elm-format with ALE.
|
||||
|
||||
call ale#Set('elm_format_executable', 'elm-format')
|
||||
call ale#Set('elm_format_use_global', 0)
|
||||
call ale#Set('elm_format_options', '--yes')
|
||||
|
||||
function! ale#fixers#elm_format#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'elm_format', [
|
||||
\ 'node_modules/.bin/elm-format',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#elm_format#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'elm_format_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#elm_format#GetExecutable(a:buffer))
|
||||
\ . ' %t'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options),
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
70
sources_non_forked/ale/autoload/ale/fixers/eslint.vim
Normal file
70
sources_non_forked/ale/autoload/ale/fixers/eslint.vim
Normal file
@ -0,0 +1,70 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Fixing files with eslint.
|
||||
|
||||
function! ale#fixers#eslint#Fix(buffer) abort
|
||||
let l:executable = ale#handlers#eslint#GetExecutable(a:buffer)
|
||||
|
||||
let l:command = ale#semver#HasVersion(l:executable)
|
||||
\ ? ''
|
||||
\ : ale#node#Executable(a:buffer, l:executable) . ' --version'
|
||||
|
||||
return {
|
||||
\ 'command': l:command,
|
||||
\ 'chain_with': 'ale#fixers#eslint#ApplyFixForVersion',
|
||||
\}
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#eslint#ProcessFixDryRunOutput(buffer, output) abort
|
||||
for l:item in ale#util#FuzzyJSONDecode(a:output, [])
|
||||
return split(get(l:item, 'output', ''), "\n")
|
||||
endfor
|
||||
|
||||
return []
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#eslint#ProcessEslintDOutput(buffer, output) abort
|
||||
" If the output is an error message, don't use it.
|
||||
for l:line in a:output[:10]
|
||||
if l:line =~# '^Error:'
|
||||
return []
|
||||
endif
|
||||
endfor
|
||||
|
||||
return a:output
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#eslint#ApplyFixForVersion(buffer, version_output) abort
|
||||
let l:executable = ale#handlers#eslint#GetExecutable(a:buffer)
|
||||
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
|
||||
|
||||
let l:config = ale#handlers#eslint#FindConfig(a:buffer)
|
||||
|
||||
if empty(l:config)
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Use --fix-to-stdout with eslint_d
|
||||
if l:executable =~# 'eslint_d$' && ale#semver#GTE(l:version, [3, 19, 0])
|
||||
return {
|
||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||
\ . ' --stdin-filename %s --stdin --fix-to-stdout',
|
||||
\ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput',
|
||||
\}
|
||||
endif
|
||||
|
||||
" 4.9.0 is the first version with --fix-dry-run
|
||||
if ale#semver#GTE(l:version, [4, 9, 0])
|
||||
return {
|
||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||
\ . ' --stdin-filename %s --stdin --fix-dry-run --format=json',
|
||||
\ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput',
|
||||
\}
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||
\ . ' -c ' . ale#Escape(l:config)
|
||||
\ . ' --fix %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
27
sources_non_forked/ale/autoload/ale/fixers/fixjson.vim
Normal file
27
sources_non_forked/ale/autoload/ale/fixers/fixjson.vim
Normal file
@ -0,0 +1,27 @@
|
||||
" Author: rhysd <https://rhysd.github.io>
|
||||
" Description: Integration of fixjson with ALE.
|
||||
|
||||
call ale#Set('json_fixjson_executable', 'fixjson')
|
||||
call ale#Set('json_fixjson_options', '')
|
||||
call ale#Set('json_fixjson_use_global', 0)
|
||||
|
||||
function! ale#fixers#fixjson#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'json_fixjson', [
|
||||
\ 'node_modules/.bin/fixjson',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#fixjson#Fix(buffer) abort
|
||||
let l:executable = ale#Escape(ale#fixers#fixjson#GetExecutable(a:buffer))
|
||||
let l:filename = ale#Escape(bufname(a:buffer))
|
||||
let l:command = l:executable . ' --stdin-filename ' . l:filename
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'json_fixjson_options')
|
||||
if l:options isnot# ''
|
||||
let l:command .= ' ' . l:options
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': l:command
|
||||
\}
|
||||
endfunction
|
25
sources_non_forked/ale/autoload/ale/fixers/generic.vim
Normal file
25
sources_non_forked/ale/autoload/ale/fixers/generic.vim
Normal file
@ -0,0 +1,25 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Generic functions for fixing files with.
|
||||
|
||||
function! ale#fixers#generic#RemoveTrailingBlankLines(buffer, lines) abort
|
||||
let l:end_index = len(a:lines) - 1
|
||||
|
||||
while l:end_index > 0 && empty(a:lines[l:end_index])
|
||||
let l:end_index -= 1
|
||||
endwhile
|
||||
|
||||
return a:lines[:l:end_index]
|
||||
endfunction
|
||||
|
||||
" Remove all whitespaces at the end of lines
|
||||
function! ale#fixers#generic#TrimWhitespace(buffer, lines) abort
|
||||
let l:index = 0
|
||||
let l:lines_new = range(len(a:lines))
|
||||
|
||||
for l:line in a:lines
|
||||
let l:lines_new[l:index] = substitute(l:line, '\s\+$', '', 'g')
|
||||
let l:index = l:index + 1
|
||||
endfor
|
||||
|
||||
return l:lines_new
|
||||
endfunction
|
@ -0,0 +1,60 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Generic fixer functions for Python.
|
||||
|
||||
" Add blank lines before control statements.
|
||||
function! ale#fixers#generic_python#AddLinesBeforeControlStatements(buffer, lines) abort
|
||||
let l:new_lines = []
|
||||
let l:last_indent_size = 0
|
||||
let l:last_line_is_blank = 0
|
||||
|
||||
for l:line in a:lines
|
||||
let l:indent_size = len(matchstr(l:line, '^ *'))
|
||||
|
||||
if !l:last_line_is_blank
|
||||
\&& l:indent_size <= l:last_indent_size
|
||||
\&& match(l:line, '\v^ *(return|if|for|while|break|continue)') >= 0
|
||||
call add(l:new_lines, '')
|
||||
endif
|
||||
|
||||
call add(l:new_lines, l:line)
|
||||
let l:last_indent_size = l:indent_size
|
||||
let l:last_line_is_blank = empty(split(l:line))
|
||||
endfor
|
||||
|
||||
return l:new_lines
|
||||
endfunction
|
||||
|
||||
" This function breaks up long lines so that autopep8 or other tools can
|
||||
" fix the badly-indented code which is produced as a result.
|
||||
function! ale#fixers#generic_python#BreakUpLongLines(buffer, lines) abort
|
||||
" Default to a maximum line length of 79
|
||||
let l:max_line_length = 79
|
||||
let l:conf = ale#path#FindNearestFile(a:buffer, 'setup.cfg')
|
||||
|
||||
" Read the maximum line length from setup.cfg
|
||||
if !empty(l:conf)
|
||||
for l:match in ale#util#GetMatches(
|
||||
\ readfile(l:conf),
|
||||
\ '\v^ *max-line-length *\= *(\d+)',
|
||||
\)
|
||||
let l:max_line_length = str2nr(l:match[1])
|
||||
endfor
|
||||
endif
|
||||
|
||||
let l:new_list = []
|
||||
|
||||
for l:line in a:lines
|
||||
if len(l:line) > l:max_line_length && l:line !~# '# *noqa'
|
||||
let l:line = substitute(l:line, '\v([(,])([^)])', '\1\n\2', 'g')
|
||||
let l:line = substitute(l:line, '\v([^(])([)])', '\1,\n\2', 'g')
|
||||
|
||||
for l:split_line in split(l:line, "\n")
|
||||
call add(l:new_list, l:split_line)
|
||||
endfor
|
||||
else
|
||||
call add(l:new_list, l:line)
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:new_list
|
||||
endfunction
|
18
sources_non_forked/ale/autoload/ale/fixers/gofmt.vim
Normal file
18
sources_non_forked/ale/autoload/ale/fixers/gofmt.vim
Normal file
@ -0,0 +1,18 @@
|
||||
" Author: aliou <code@aliou.me>
|
||||
" Description: Integration of gofmt with ALE.
|
||||
|
||||
call ale#Set('go_gofmt_executable', 'gofmt')
|
||||
call ale#Set('go_gofmt_options', '')
|
||||
|
||||
function! ale#fixers#gofmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'go_gofmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'go_gofmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -l -w'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
22
sources_non_forked/ale/autoload/ale/fixers/goimports.vim
Normal file
22
sources_non_forked/ale/autoload/ale/fixers/goimports.vim
Normal file
@ -0,0 +1,22 @@
|
||||
" Author: Jeff Willette <jrwillette88@gmail.com>
|
||||
" Description: Integration of goimports with ALE.
|
||||
|
||||
call ale#Set('go_goimports_executable', 'goimports')
|
||||
call ale#Set('go_goimports_options', '')
|
||||
|
||||
function! ale#fixers#goimports#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'go_goimports_executable')
|
||||
let l:options = ale#Var(a:buffer, 'go_goimports_options')
|
||||
|
||||
if !executable(l:executable)
|
||||
return 0
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -l -w -srcdir %s'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
@ -0,0 +1,23 @@
|
||||
" Author: butlerx <butlerx@notthe,cloud>
|
||||
" Description: Integration of Google-java-format with ALE.
|
||||
|
||||
call ale#Set('google_java_format_executable', 'google-java-format')
|
||||
call ale#Set('google_java_format_use_global', 0)
|
||||
call ale#Set('google_java_format_options', '')
|
||||
|
||||
function! ale#fixers#google_java_format#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'google_java_format_options')
|
||||
let l:executable = ale#Var(a:buffer, 'google_java_format_executable')
|
||||
|
||||
if !executable(l:executable)
|
||||
return 0
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' ' . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' --replace'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
18
sources_non_forked/ale/autoload/ale/fixers/hackfmt.vim
Normal file
18
sources_non_forked/ale/autoload/ale/fixers/hackfmt.vim
Normal file
@ -0,0 +1,18 @@
|
||||
" Author: Sam Howie <samhowie@gmail.com>
|
||||
" Description: Integration of hackfmt with ALE.
|
||||
|
||||
call ale#Set('php_hackfmt_executable', 'hackfmt')
|
||||
call ale#Set('php_hackfmt_options', '')
|
||||
|
||||
function! ale#fixers#hackfmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'php_hackfmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'php_hackfmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -i'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
24
sources_non_forked/ale/autoload/ale/fixers/help.vim
Normal file
24
sources_non_forked/ale/autoload/ale/fixers/help.vim
Normal file
@ -0,0 +1,24 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Generic fixer functions for Vim help documents.
|
||||
|
||||
function! ale#fixers#help#AlignTags(buffer, lines) abort
|
||||
let l:new_lines = []
|
||||
|
||||
for l:line in a:lines
|
||||
if len(l:line) != 79
|
||||
let l:match = matchlist(l:line, '\v +(\*[^*]+\*)$')
|
||||
|
||||
if !empty(l:match)
|
||||
let l:start = l:line[:-len(l:match[0]) - 1]
|
||||
let l:tag = l:match[1]
|
||||
let l:spaces = repeat(' ', 79 - len(l:start) - len(l:tag))
|
||||
|
||||
let l:line = l:start . l:spaces . l:tag
|
||||
endif
|
||||
endif
|
||||
|
||||
call add(l:new_lines, l:line)
|
||||
endfor
|
||||
|
||||
return l:new_lines
|
||||
endfunction
|
16
sources_non_forked/ale/autoload/ale/fixers/hfmt.vim
Normal file
16
sources_non_forked/ale/autoload/ale/fixers/hfmt.vim
Normal file
@ -0,0 +1,16 @@
|
||||
" Author: zack <zack@kourouma.me>
|
||||
" Description: Integration of hfmt with ALE.
|
||||
|
||||
call ale#Set('haskell_hfmt_executable', 'hfmt')
|
||||
|
||||
function! ale#fixers#hfmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'haskell_hfmt_executable')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -w'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
|
24
sources_non_forked/ale/autoload/ale/fixers/importjs.vim
Normal file
24
sources_non_forked/ale/autoload/ale/fixers/importjs.vim
Normal file
@ -0,0 +1,24 @@
|
||||
" Author: Jeff Willette <jrwillette88@gmail.com>
|
||||
" Description: Integration of importjs with ALE.
|
||||
|
||||
call ale#Set('js_importjs_executable', 'importjs')
|
||||
|
||||
function! ale#fixers#importjs#ProcessOutput(buffer, output) abort
|
||||
let l:result = ale#util#FuzzyJSONDecode(a:output, [])
|
||||
return split(get(l:result, 'fileContent', ''), "\n")
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#importjs#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'js_importjs_executable')
|
||||
|
||||
if !executable(l:executable)
|
||||
return 0
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' fix'
|
||||
\ . ' %s',
|
||||
\ 'process_with': 'ale#fixers#importjs#ProcessOutput',
|
||||
\}
|
||||
endfunction
|
22
sources_non_forked/ale/autoload/ale/fixers/isort.vim
Normal file
22
sources_non_forked/ale/autoload/ale/fixers/isort.vim
Normal file
@ -0,0 +1,22 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Fixing Python imports with isort.
|
||||
|
||||
call ale#Set('python_isort_executable', 'isort')
|
||||
call ale#Set('python_isort_use_global', 0)
|
||||
|
||||
function! ale#fixers#isort#Fix(buffer) abort
|
||||
let l:executable = ale#python#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'python_isort',
|
||||
\ ['isort'],
|
||||
\)
|
||||
|
||||
if !executable(l:executable)
|
||||
return 0
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(l:executable) . ' -',
|
||||
\}
|
||||
endfunction
|
15
sources_non_forked/ale/autoload/ale/fixers/jq.vim
Normal file
15
sources_non_forked/ale/autoload/ale/fixers/jq.vim
Normal file
@ -0,0 +1,15 @@
|
||||
call ale#Set('json_jq_executable', 'jq')
|
||||
call ale#Set('json_jq_options', '')
|
||||
|
||||
function! ale#fixers#jq#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'json_jq_executable')
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#jq#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'json_jq_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#jq#GetExecutable(a:buffer))
|
||||
\ . ' . ' . l:options,
|
||||
\}
|
||||
endfunction
|
25
sources_non_forked/ale/autoload/ale/fixers/mix_format.vim
Normal file
25
sources_non_forked/ale/autoload/ale/fixers/mix_format.vim
Normal file
@ -0,0 +1,25 @@
|
||||
" Author: carakan <carakan@gmail.com>, Fernando Mendes <fernando@mendes.codes>
|
||||
" Description: Fixing files with elixir formatter 'mix format'.
|
||||
|
||||
call ale#Set('elixir_mix_executable', 'mix')
|
||||
call ale#Set('elixir_mix_format_options', '')
|
||||
|
||||
function! ale#fixers#mix_format#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'elixir_mix_executable')
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#mix_format#GetCommand(buffer) abort
|
||||
let l:executable = ale#Escape(ale#fixers#mix_format#GetExecutable(a:buffer))
|
||||
let l:options = ale#Var(a:buffer, 'elixir_mix_format_options')
|
||||
|
||||
return l:executable . ' format'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#mix_format#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#fixers#mix_format#GetCommand(a:buffer),
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
23
sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim
Normal file
23
sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim
Normal file
@ -0,0 +1,23 @@
|
||||
" Author: Julien Deniau <julien.deniau@gmail.com>
|
||||
" Description: Fixing files with php-cs-fixer.
|
||||
|
||||
call ale#Set('php_cs_fixer_executable', 'php-cs-fixer')
|
||||
call ale#Set('php_cs_fixer_use_global', 0)
|
||||
|
||||
function! ale#fixers#php_cs_fixer#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'php_cs_fixer', [
|
||||
\ 'vendor/bin/php-cs-fixer',
|
||||
\ 'php-cs-fixer'
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#php_cs_fixer#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#php_cs_fixer#GetExecutable(a:buffer)
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' fix %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
|
||||
|
||||
|
24
sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim
Normal file
24
sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim
Normal file
@ -0,0 +1,24 @@
|
||||
" Author: notomo <notomo.motono@gmail.com>
|
||||
" Description: Fixing files with phpcbf.
|
||||
|
||||
call ale#Set('php_phpcbf_standard', '')
|
||||
call ale#Set('php_phpcbf_executable', 'phpcbf')
|
||||
call ale#Set('php_phpcbf_use_global', 0)
|
||||
|
||||
function! ale#fixers#phpcbf#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'php_phpcbf', [
|
||||
\ 'vendor/bin/phpcbf',
|
||||
\ 'phpcbf'
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#phpcbf#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#phpcbf#GetExecutable(a:buffer)
|
||||
let l:standard = ale#Var(a:buffer, 'php_phpcbf_standard')
|
||||
let l:standard_option = !empty(l:standard)
|
||||
\ ? '--standard=' . l:standard
|
||||
\ : ''
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' --stdin-path=%s ' . l:standard_option . ' -'
|
||||
\}
|
||||
endfunction
|
53
sources_non_forked/ale/autoload/ale/fixers/prettier.vim
Normal file
53
sources_non_forked/ale/autoload/ale/fixers/prettier.vim
Normal file
@ -0,0 +1,53 @@
|
||||
" Author: tunnckoCore (Charlike Mike Reagent) <mameto2011@gmail.com>,
|
||||
" w0rp <devw0rp@gmail.com>, morhetz (Pavel Pertsev) <morhetz@gmail.com>
|
||||
" Description: Integration of Prettier with ALE.
|
||||
|
||||
call ale#Set('javascript_prettier_executable', 'prettier')
|
||||
call ale#Set('javascript_prettier_use_global', 0)
|
||||
call ale#Set('javascript_prettier_options', '')
|
||||
|
||||
function! ale#fixers#prettier#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_prettier', [
|
||||
\ 'node_modules/.bin/prettier_d',
|
||||
\ 'node_modules/prettier-cli/index.js',
|
||||
\ 'node_modules/.bin/prettier',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#prettier#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#prettier#GetExecutable(a:buffer)
|
||||
|
||||
let l:command = ale#semver#HasVersion(l:executable)
|
||||
\ ? ''
|
||||
\ : ale#Escape(l:executable) . ' --version'
|
||||
|
||||
return {
|
||||
\ 'command': l:command,
|
||||
\ 'chain_with': 'ale#fixers#prettier#ApplyFixForVersion',
|
||||
\}
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort
|
||||
let l:executable = ale#fixers#prettier#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'javascript_prettier_options')
|
||||
|
||||
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
|
||||
|
||||
" 1.4.0 is the first version with --stdin-filepath
|
||||
if ale#semver#GTE(l:version, [1, 4, 0])
|
||||
return {
|
||||
\ 'command': ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\}
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' %t'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --write',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
@ -0,0 +1,66 @@
|
||||
" Author: tunnckoCore (Charlike Mike Reagent) <mameto2011@gmail.com>,
|
||||
" w0rp <devw0rp@gmail.com>, morhetz (Pavel Pertsev) <morhetz@gmail.com>
|
||||
" Description: Integration between Prettier and ESLint.
|
||||
|
||||
function! ale#fixers#prettier_eslint#SetOptionDefaults() abort
|
||||
call ale#Set('javascript_prettier_eslint_executable', 'prettier-eslint')
|
||||
call ale#Set('javascript_prettier_eslint_use_global', 0)
|
||||
call ale#Set('javascript_prettier_eslint_options', '')
|
||||
endfunction
|
||||
|
||||
call ale#fixers#prettier_eslint#SetOptionDefaults()
|
||||
|
||||
function! ale#fixers#prettier_eslint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_prettier_eslint', [
|
||||
\ 'node_modules/prettier-eslint-cli/dist/index.js',
|
||||
\ 'node_modules/.bin/prettier-eslint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#prettier_eslint#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#prettier_eslint#GetExecutable(a:buffer)
|
||||
|
||||
let l:command = ale#semver#HasVersion(l:executable)
|
||||
\ ? ''
|
||||
\ : ale#Escape(l:executable) . ' --version'
|
||||
|
||||
return {
|
||||
\ 'command': l:command,
|
||||
\ 'chain_with': 'ale#fixers#prettier_eslint#ApplyFixForVersion',
|
||||
\}
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version_output) abort
|
||||
let l:options = ale#Var(a:buffer, 'javascript_prettier_eslint_options')
|
||||
let l:executable = ale#fixers#prettier_eslint#GetExecutable(a:buffer)
|
||||
|
||||
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
|
||||
|
||||
" 4.2.0 is the first version with --eslint-config-path
|
||||
let l:config = ale#semver#GTE(l:version, [4, 2, 0])
|
||||
\ ? ale#handlers#eslint#FindConfig(a:buffer)
|
||||
\ : ''
|
||||
let l:eslint_config_option = !empty(l:config)
|
||||
\ ? ' --eslint-config-path ' . ale#Escape(l:config)
|
||||
\ : ''
|
||||
|
||||
" 4.4.0 is the first version with --stdin-filepath
|
||||
if ale#semver#GTE(l:version, [4, 4, 0])
|
||||
return {
|
||||
\ 'command': ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . l:eslint_config_option
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\}
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' %t'
|
||||
\ . l:eslint_config_option
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --write',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
@ -0,0 +1,24 @@
|
||||
" Author: sheerun (Adam Stankiewicz) <sheerun@sher.pl>
|
||||
" Description: Integration of Prettier Standard with ALE.
|
||||
|
||||
call ale#Set('javascript_prettier_standard_executable', 'prettier-standard')
|
||||
call ale#Set('javascript_prettier_standard_use_global', 0)
|
||||
call ale#Set('javascript_prettier_standard_options', '')
|
||||
|
||||
function! ale#fixers#prettier_standard#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_prettier_standard', [
|
||||
\ 'node_modules/prettier-standard/lib/index.js',
|
||||
\ 'node_modules/.bin/prettier-standard',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#prettier_standard#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'javascript_prettier_standard_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#prettier_standard#GetExecutable(a:buffer))
|
||||
\ . ' %t'
|
||||
\ . ' ' . l:options,
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
21
sources_non_forked/ale/autoload/ale/fixers/puppetlint.vim
Normal file
21
sources_non_forked/ale/autoload/ale/fixers/puppetlint.vim
Normal file
@ -0,0 +1,21 @@
|
||||
" Author: Alexander Olofsson <alexander.olofsson@liu.se>
|
||||
" Description: puppet-lint fixer
|
||||
|
||||
if !exists('g:ale_puppet_puppetlint_executable')
|
||||
let g:ale_puppet_puppetlint_executable = 'puppet-lint'
|
||||
endif
|
||||
if !exists('g:ale_puppet_puppetlint_options')
|
||||
let g:ale_puppet_puppetlint_options = ''
|
||||
endif
|
||||
|
||||
function! ale#fixers#puppetlint#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'puppet_puppetlint_executable')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' ' . ale#Var(a:buffer, 'puppet_puppetlint_options')
|
||||
\ . ' --fix'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
18
sources_non_forked/ale/autoload/ale/fixers/refmt.vim
Normal file
18
sources_non_forked/ale/autoload/ale/fixers/refmt.vim
Normal file
@ -0,0 +1,18 @@
|
||||
" Author: Ahmed El Gabri <@ahmedelgabri>
|
||||
" Description: Integration of refmt with ALE.
|
||||
|
||||
call ale#Set('reasonml_refmt_executable', 'refmt')
|
||||
call ale#Set('reasonml_refmt_options', '')
|
||||
|
||||
function! ale#fixers#refmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'reasonml_refmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'reasonml_refmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' --in-place'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
21
sources_non_forked/ale/autoload/ale/fixers/rubocop.vim
Normal file
21
sources_non_forked/ale/autoload/ale/fixers/rubocop.vim
Normal file
@ -0,0 +1,21 @@
|
||||
function! ale#fixers#rubocop#GetCommand(buffer) abort
|
||||
let l:executable = ale#handlers#rubocop#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'bundle$'
|
||||
\ ? ' exec rubocop'
|
||||
\ : ''
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, '.rubocop.yml')
|
||||
let l:options = ale#Var(a:buffer, 'ruby_rubocop_options')
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --auto-correct %t'
|
||||
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#rubocop#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#fixers#rubocop#GetCommand(a:buffer),
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
20
sources_non_forked/ale/autoload/ale/fixers/rufo.vim
Normal file
20
sources_non_forked/ale/autoload/ale/fixers/rufo.vim
Normal file
@ -0,0 +1,20 @@
|
||||
" Author: Fohte (Hayato Kawai) https://github.com/fohte
|
||||
" Description: Integration of Rufo with ALE.
|
||||
|
||||
call ale#Set('ruby_rufo_executable', 'rufo')
|
||||
|
||||
function! ale#fixers#rufo#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_rufo_executable')
|
||||
let l:exec_args = l:executable =~? 'bundle$'
|
||||
\ ? ' exec rufo'
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#rufo#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#fixers#rufo#GetCommand(a:buffer),
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
15
sources_non_forked/ale/autoload/ale/fixers/rustfmt.vim
Normal file
15
sources_non_forked/ale/autoload/ale/fixers/rustfmt.vim
Normal file
@ -0,0 +1,15 @@
|
||||
" Author: Kelly Fox <kelly@bumfuddled.com>
|
||||
" Description: Integration of rustfmt with ALE.
|
||||
|
||||
call ale#Set('rust_rustfmt_executable', 'rustfmt')
|
||||
call ale#Set('rust_rustfmt_options', '')
|
||||
|
||||
function! ale#fixers#rustfmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'rust_rustfmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'rust_rustfmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options),
|
||||
\}
|
||||
endfunction
|
17
sources_non_forked/ale/autoload/ale/fixers/shfmt.vim
Normal file
17
sources_non_forked/ale/autoload/ale/fixers/shfmt.vim
Normal file
@ -0,0 +1,17 @@
|
||||
scriptencoding utf-8
|
||||
" Author: Simon Bugert <simon.bugert@gmail.com>
|
||||
" Description: Fix sh files with shfmt.
|
||||
|
||||
call ale#Set('sh_shfmt_executable', 'shfmt')
|
||||
call ale#Set('sh_shfmt_options', '')
|
||||
|
||||
function! ale#fixers#shfmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'sh_shfmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'sh_shfmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\}
|
||||
|
||||
endfunction
|
23
sources_non_forked/ale/autoload/ale/fixers/standard.vim
Normal file
23
sources_non_forked/ale/autoload/ale/fixers/standard.vim
Normal file
@ -0,0 +1,23 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: Fixing files with Standard.
|
||||
|
||||
call ale#Set('javascript_standard_executable', 'standard')
|
||||
call ale#Set('javascript_standard_use_global', 0)
|
||||
call ale#Set('javascript_standard_options', '')
|
||||
|
||||
function! ale#fixers#standard#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_standard', [
|
||||
\ 'node_modules/standard/bin/cmd.js',
|
||||
\ 'node_modules/.bin/standard',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#standard#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#standard#GetExecutable(a:buffer)
|
||||
|
||||
return {
|
||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||
\ . ' --fix %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
23
sources_non_forked/ale/autoload/ale/fixers/stylelint.vim
Normal file
23
sources_non_forked/ale/autoload/ale/fixers/stylelint.vim
Normal file
@ -0,0 +1,23 @@
|
||||
" Author: Mahmoud Mostafa <mah@moud.info>
|
||||
" Description: Fixing files with stylelint.
|
||||
|
||||
call ale#Set('stylelint_executable', 'stylelint')
|
||||
call ale#Set('stylelint_use_global', 0)
|
||||
|
||||
function! ale#fixers#stylelint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'stylelint', [
|
||||
\ 'node_modules/stylelint/bin/stylelint.js',
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale#fixers#stylelint#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#stylelint#GetExecutable(a:buffer)
|
||||
|
||||
return {
|
||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||
\ . ' --fix %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
25
sources_non_forked/ale/autoload/ale/fixers/swiftformat.vim
Normal file
25
sources_non_forked/ale/autoload/ale/fixers/swiftformat.vim
Normal file
@ -0,0 +1,25 @@
|
||||
" Author: gfontenot (Gordon Fontenot) <gordon@fonten.io>
|
||||
" Description: Integration of SwiftFormat with ALE.
|
||||
|
||||
call ale#Set('swift_swiftformat_executable', 'swiftformat')
|
||||
call ale#Set('swift_swiftformat_use_global', 0)
|
||||
call ale#Set('swift_swiftformat_options', '')
|
||||
|
||||
function! ale#fixers#swiftformat#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'swift_swiftformat', [
|
||||
\ 'Pods/SwiftFormat/CommandLineTool/swiftformat',
|
||||
\ 'ios/Pods/SwiftFormat/CommandLineTool/swiftformat',
|
||||
\ 'swiftformat',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#swiftformat#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'swift_swiftformat_options')
|
||||
|
||||
return {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape(ale#fixers#swiftformat#GetExecutable(a:buffer))
|
||||
\ . ' %t'
|
||||
\ . ' ' . l:options,
|
||||
\}
|
||||
endfunction
|
22
sources_non_forked/ale/autoload/ale/fixers/tslint.vim
Normal file
22
sources_non_forked/ale/autoload/ale/fixers/tslint.vim
Normal file
@ -0,0 +1,22 @@
|
||||
" Author: carakan <carakan@gmail.com>
|
||||
" Description: Fixing files with tslint.
|
||||
|
||||
function! ale#fixers#tslint#Fix(buffer) abort
|
||||
let l:executable = ale_linters#typescript#tslint#GetExecutable(a:buffer)
|
||||
|
||||
let l:tslint_config_path = ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'tslint.json',
|
||||
\ ale#Var(a:buffer, 'typescript_tslint_config_path')
|
||||
\)
|
||||
let l:tslint_config_option = !empty(l:tslint_config_path)
|
||||
\ ? ' -c ' . ale#Escape(l:tslint_config_path)
|
||||
\ : ''
|
||||
|
||||
return {
|
||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||
\ . l:tslint_config_option
|
||||
\ . ' --fix %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
26
sources_non_forked/ale/autoload/ale/fixers/yapf.vim
Normal file
26
sources_non_forked/ale/autoload/ale/fixers/yapf.vim
Normal file
@ -0,0 +1,26 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Fixing Python files with yapf.
|
||||
|
||||
call ale#Set('python_yapf_executable', 'yapf')
|
||||
call ale#Set('python_yapf_use_global', 0)
|
||||
|
||||
function! ale#fixers#yapf#Fix(buffer) abort
|
||||
let l:executable = ale#python#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'python_yapf',
|
||||
\ ['yapf'],
|
||||
\)
|
||||
|
||||
if !executable(l:executable)
|
||||
return 0
|
||||
endif
|
||||
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, '.style.yapf')
|
||||
let l:config_options = !empty(l:config)
|
||||
\ ? ' --no-local-style --style ' . ale#Escape(l:config)
|
||||
\ : ''
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . l:config_options,
|
||||
\}
|
||||
endfunction
|
Reference in New Issue
Block a user