mirror of
https://github.com/amix/vimrc
synced 2025-07-01 12:45:00 +08:00
Updated plugins
This commit is contained in:
@ -303,12 +303,12 @@ let s:default_registry = {
|
||||
\ },
|
||||
\ 'ocamlformat': {
|
||||
\ 'function': 'ale#fixers#ocamlformat#Fix',
|
||||
\ 'suggested_filetypes': ['ocaml'],
|
||||
\ 'suggested_filetypes': ['ocaml', 'ocamlinterface'],
|
||||
\ 'description': 'Fix OCaml files with ocamlformat.',
|
||||
\ },
|
||||
\ 'ocp-indent': {
|
||||
\ 'function': 'ale#fixers#ocp_indent#Fix',
|
||||
\ 'suggested_filetypes': ['ocaml'],
|
||||
\ 'suggested_filetypes': ['ocaml', 'ocamlinterface'],
|
||||
\ 'description': 'Fix OCaml files with ocp-indent.',
|
||||
\ },
|
||||
\ 'refmt': {
|
||||
|
@ -6,7 +6,7 @@ call ale#Set('bazel_buildifier_use_global', get(g:, 'ale_use_global_executables'
|
||||
call ale#Set('bazel_buildifier_options', '')
|
||||
|
||||
function! ale#fixers#buildifier#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'bazel_buildifier', [
|
||||
return ale#path#FindExecutable(a:buffer, 'bazel_buildifier', [
|
||||
\ 'buildifier',
|
||||
\])
|
||||
endfunction
|
||||
|
@ -9,7 +9,7 @@ call ale#Set('c_clangformat_style_option', '')
|
||||
call ale#Set('c_clangformat_use_local_file', 0)
|
||||
|
||||
function! ale#fixers#clangformat#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'c_clangformat', [
|
||||
return ale#path#FindExecutable(a:buffer, 'c_clangformat', [
|
||||
\ 'clang-format',
|
||||
\])
|
||||
endfunction
|
||||
|
@ -10,9 +10,7 @@ function! ale#fixers#cmakeformat#Fix(buffer) abort
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -i '
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\ . ' -'
|
||||
\}
|
||||
endfunction
|
||||
|
@ -6,7 +6,7 @@ call ale#Set('elm_format_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('elm_format_options', '--yes')
|
||||
|
||||
function! ale#fixers#elm_format#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'elm_format', [
|
||||
return ale#path#FindExecutable(a:buffer, 'elm_format', [
|
||||
\ 'node_modules/.bin/elm-format',
|
||||
\])
|
||||
endfunction
|
||||
|
@ -6,7 +6,7 @@ call ale#Set('erlang_erlfmt_use_global', get(g:, 'ale_use_global_executables', 0
|
||||
call ale#Set('erlang_erlfmt_options', '')
|
||||
|
||||
function! ale#fixers#erlfmt#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'erlang_erlfmt', ['erlfmt'])
|
||||
return ale#path#FindExecutable(a:buffer, 'erlang_erlfmt', ['erlfmt'])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#erlfmt#Fix(buffer) abort
|
||||
|
@ -6,7 +6,7 @@ call ale#Set('json_fixjson_options', '')
|
||||
call ale#Set('json_fixjson_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale#fixers#fixjson#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'json_fixjson', [
|
||||
return ale#path#FindExecutable(a:buffer, 'json_fixjson', [
|
||||
\ 'node_modules/.bin/fixjson',
|
||||
\])
|
||||
endfunction
|
||||
|
@ -6,7 +6,7 @@ call ale#Set('php_cs_fixer_use_global', get(g:, 'ale_use_global_executables', 0)
|
||||
call ale#Set('php_cs_fixer_options', '')
|
||||
|
||||
function! ale#fixers#php_cs_fixer#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'php_cs_fixer', [
|
||||
return ale#path#FindExecutable(a:buffer, 'php_cs_fixer', [
|
||||
\ 'vendor/bin/php-cs-fixer',
|
||||
\ 'php-cs-fixer'
|
||||
\])
|
||||
|
@ -7,7 +7,7 @@ call ale#Set('php_phpcbf_executable', 'phpcbf')
|
||||
call ale#Set('php_phpcbf_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale#fixers#phpcbf#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'php_phpcbf', [
|
||||
return ale#path#FindExecutable(a:buffer, 'php_phpcbf', [
|
||||
\ 'vendor/bin/phpcbf',
|
||||
\ 'phpcbf'
|
||||
\])
|
||||
|
@ -7,7 +7,7 @@ call ale#Set('javascript_prettier_use_global', get(g:, 'ale_use_global_executabl
|
||||
call ale#Set('javascript_prettier_options', '')
|
||||
|
||||
function! ale#fixers#prettier#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_prettier', [
|
||||
return ale#path#FindExecutable(a:buffer, 'javascript_prettier', [
|
||||
\ 'node_modules/.bin/prettier_d',
|
||||
\ 'node_modules/prettier-cli/index.js',
|
||||
\ 'node_modules/.bin/prettier',
|
||||
|
@ -7,7 +7,7 @@ call ale#Set('javascript_prettier_eslint_use_global', get(g:, 'ale_use_global_ex
|
||||
call ale#Set('javascript_prettier_eslint_options', '')
|
||||
|
||||
function! ale#fixers#prettier_eslint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_prettier_eslint', [
|
||||
return ale#path#FindExecutable(a:buffer, 'javascript_prettier_eslint', [
|
||||
\ 'node_modules/prettier-eslint-cli/dist/index.js',
|
||||
\ 'node_modules/.bin/prettier-eslint',
|
||||
\])
|
||||
|
@ -6,7 +6,7 @@ call ale#Set('javascript_prettier_standard_use_global', get(g:, 'ale_use_global_
|
||||
call ale#Set('javascript_prettier_standard_options', '')
|
||||
|
||||
function! ale#fixers#prettier_standard#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_prettier_standard', [
|
||||
return ale#path#FindExecutable(a:buffer, 'javascript_prettier_standard', [
|
||||
\ 'node_modules/prettier-standard/lib/index.js',
|
||||
\ 'node_modules/.bin/prettier-standard',
|
||||
\])
|
||||
|
@ -6,7 +6,7 @@ call ale#Set('markdown_remark_lint_use_global', get(g:, 'ale_use_global_executab
|
||||
call ale#Set('markdown_remark_lint_options', '')
|
||||
|
||||
function! ale#fixers#remark_lint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'markdown_remark_lint', [
|
||||
return ale#path#FindExecutable(a:buffer, 'markdown_remark_lint', [
|
||||
\ 'node_modules/remark-cli/cli.js',
|
||||
\ 'node_modules/.bin/remark',
|
||||
\])
|
||||
|
@ -6,7 +6,7 @@ call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executabl
|
||||
call ale#Set('javascript_standard_options', '')
|
||||
|
||||
function! ale#fixers#standard#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_standard', [
|
||||
return ale#path#FindExecutable(a:buffer, 'javascript_standard', [
|
||||
\ 'node_modules/standardx/bin/cmd.js',
|
||||
\ 'node_modules/standard/bin/cmd.js',
|
||||
\ 'node_modules/.bin/standard',
|
||||
|
@ -6,7 +6,7 @@ call ale#Set('stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('stylelint_options', '')
|
||||
|
||||
function! ale#fixers#stylelint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'stylelint', [
|
||||
return ale#path#FindExecutable(a:buffer, 'stylelint', [
|
||||
\ 'node_modules/stylelint/bin/stylelint.js',
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\])
|
||||
|
@ -6,7 +6,7 @@ call ale#Set('swift_swiftformat_use_global', get(g:, 'ale_use_global_executables
|
||||
call ale#Set('swift_swiftformat_options', '')
|
||||
|
||||
function! ale#fixers#swiftformat#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'swift_swiftformat', [
|
||||
return ale#path#FindExecutable(a:buffer, 'swift_swiftformat', [
|
||||
\ 'Pods/SwiftFormat/CommandLineTool/swiftformat',
|
||||
\ 'ios/Pods/SwiftFormat/CommandLineTool/swiftformat',
|
||||
\ 'swiftformat',
|
||||
|
@ -5,7 +5,7 @@ call ale#Set('html_tidy_executable', 'tidy')
|
||||
call ale#Set('html_tidy_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale#fixers#tidy#Fix(buffer) abort
|
||||
let l:executable = ale#node#FindExecutable(
|
||||
let l:executable = ale#path#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'html_tidy',
|
||||
\ ['tidy'],
|
||||
|
@ -42,3 +42,17 @@ function! ale#go#EnvString(buffer) abort
|
||||
|
||||
return l:env
|
||||
endfunction
|
||||
|
||||
function! ale#go#GetGoPathExecutable(suffix) abort
|
||||
let l:prefix = $GOPATH
|
||||
|
||||
if !empty($GOPATH)
|
||||
let l:prefix = $GOPATH
|
||||
elseif has('win32')
|
||||
let l:prefix = $USERPROFILE . '/go'
|
||||
else
|
||||
let l:prefix = $HOME . '/go'
|
||||
endif
|
||||
|
||||
return ale#path#Simplify(l:prefix . '/' . a:suffix)
|
||||
endfunction
|
||||
|
@ -3,7 +3,7 @@ scriptencoding utf-8
|
||||
" Description: Error handling for errors in alex output format
|
||||
|
||||
function! ale#handlers#alex#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'alex', [
|
||||
return ale#path#FindExecutable(a:buffer, 'alex', [
|
||||
\ 'node_modules/.bin/alex',
|
||||
\ 'node_modules/alex/cli.js',
|
||||
\])
|
||||
|
@ -36,7 +36,7 @@ function! ale#handlers#eslint#FindConfig(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#eslint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_eslint', s:executables)
|
||||
return ale#path#FindExecutable(a:buffer, 'javascript_eslint', s:executables)
|
||||
endfunction
|
||||
|
||||
" Given a buffer, return an appropriate working directory for ESLint.
|
||||
@ -49,7 +49,7 @@ function! ale#handlers#eslint#GetCwd(buffer) abort
|
||||
" If eslint is installed in a directory which contains the buffer, assume
|
||||
" it is the ESLint project root. Otherwise, use nearest node_modules.
|
||||
" Note: If node_modules not present yet, can't load local deps anyway.
|
||||
let l:executable = ale#node#FindNearestExecutable(a:buffer, s:executables)
|
||||
let l:executable = ale#path#FindNearestExecutable(a:buffer, s:executables)
|
||||
|
||||
if !empty(l:executable)
|
||||
let l:nmi = strridx(l:executable, 'node_modules')
|
||||
|
@ -9,7 +9,7 @@ function! ale#handlers#fecs#GetCommand(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#fecs#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_fecs', [
|
||||
return ale#path#FindExecutable(a:buffer, 'javascript_fecs', [
|
||||
\ 'node_modules/.bin/fecs',
|
||||
\ 'node_modules/fecs/bin/fecs',
|
||||
\])
|
||||
|
@ -1,6 +1,13 @@
|
||||
" Author: Risto Stevcev <me@risto.codes>
|
||||
" Description: Handlers for the official OCaml language server
|
||||
|
||||
let s:language_id_of_filetype = {
|
||||
\ 'menhir': 'ocaml.menhir',
|
||||
\ 'ocaml': 'ocaml',
|
||||
\ 'ocamlinterface': 'ocaml.interface',
|
||||
\ 'ocamllex': 'ocaml.lex'
|
||||
\}
|
||||
|
||||
function! ale#handlers#ocamllsp#GetExecutable(buffer) abort
|
||||
return 'ocamllsp'
|
||||
endfunction
|
||||
@ -13,7 +20,7 @@ function! ale#handlers#ocamllsp#GetCommand(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#ocamllsp#GetLanguage(buffer) abort
|
||||
return getbufvar(a:buffer, '&filetype')
|
||||
return s:language_id_of_filetype[getbufvar(a:buffer, '&filetype')]
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#ocamllsp#GetProjectRoot(buffer) abort
|
||||
|
@ -4,7 +4,7 @@
|
||||
function! ale#handlers#ols#GetExecutable(buffer) abort
|
||||
let l:ols_setting = ale#handlers#ols#GetLanguage(a:buffer) . '_ols'
|
||||
|
||||
return ale#node#FindExecutable(a:buffer, l:ols_setting, [
|
||||
return ale#path#FindExecutable(a:buffer, l:ols_setting, [
|
||||
\ 'node_modules/.bin/ocaml-language-server',
|
||||
\])
|
||||
endfunction
|
||||
|
@ -66,7 +66,7 @@ function! ale#handlers#solhint#FindConfig(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#solhint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'solidity_solhint', s:executables)
|
||||
return ale#path#FindExecutable(a:buffer, 'solidity_solhint', s:executables)
|
||||
endfunction
|
||||
|
||||
" Given a buffer, return an appropriate working directory for solhint.
|
||||
@ -74,7 +74,7 @@ function! ale#handlers#solhint#GetCwd(buffer) abort
|
||||
" If solhint is installed in a directory which contains the buffer, assume
|
||||
" it is the solhint project root. Otherwise, use nearest node_modules.
|
||||
" Note: If node_modules not present yet, can't load local deps anyway.
|
||||
let l:executable = ale#node#FindNearestExecutable(a:buffer, s:executables)
|
||||
let l:executable = ale#path#FindNearestExecutable(a:buffer, s:executables)
|
||||
|
||||
if !empty(l:executable)
|
||||
let l:nmi = strridx(l:executable, 'node_modules')
|
||||
|
@ -6,7 +6,7 @@ call ale#Set('textlint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('textlint_options', '')
|
||||
|
||||
function! ale#handlers#textlint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'textlint', [
|
||||
return ale#path#FindExecutable(a:buffer, 'textlint', [
|
||||
\ 'node_modules/.bin/textlint',
|
||||
\ 'node_modules/textlint/bin/textlint.js',
|
||||
\])
|
||||
|
@ -7,7 +7,7 @@ function! ale#handlers#tslint#InitVariables() abort
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#tslint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'typescript_tslint', [
|
||||
return ale#path#FindExecutable(a:buffer, 'typescript_tslint', [
|
||||
\ 'node_modules/.bin/tslint',
|
||||
\])
|
||||
endfunction
|
||||
|
@ -11,7 +11,7 @@ endfunction
|
||||
call ale#handlers#writegood#ResetOptions()
|
||||
|
||||
function! ale#handlers#writegood#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'writegood', [
|
||||
return ale#path#FindExecutable(a:buffer, 'writegood', [
|
||||
\ 'node_modules/.bin/write-good',
|
||||
\ 'node_modules/write-good/bin/write-good.js',
|
||||
\])
|
||||
|
@ -9,7 +9,7 @@ call ale#Set('typescript_xo_options', '')
|
||||
function! ale#handlers#xo#GetExecutable(buffer) abort
|
||||
let l:type = ale#handlers#xo#GetType(a:buffer)
|
||||
|
||||
return ale#node#FindExecutable(a:buffer, l:type . '_xo', [
|
||||
return ale#path#FindExecutable(a:buffer, l:type . '_xo', [
|
||||
\ 'node_modules/xo/cli.js',
|
||||
\ 'node_modules/.bin/xo',
|
||||
\])
|
||||
|
@ -41,7 +41,7 @@ let s:default_ale_linters = {
|
||||
\ 'apkbuild': ['apkbuild_lint', 'secfixes_check'],
|
||||
\ 'csh': ['shell'],
|
||||
\ 'elixir': ['credo', 'dialyxir', 'dogma'],
|
||||
\ 'go': ['gofmt', 'golint', 'go vet'],
|
||||
\ 'go': ['gofmt', 'golint', 'gopls', 'govet'],
|
||||
\ 'hack': ['hack'],
|
||||
\ 'help': [],
|
||||
\ 'inko': ['inko'],
|
||||
|
@ -3,38 +3,6 @@
|
||||
|
||||
call ale#Set('windows_node_executable_path', 'node.exe')
|
||||
|
||||
" Given a buffer number, a base variable name, and a list of paths to search
|
||||
" for in ancestor directories, detect the executable path for a Node program.
|
||||
"
|
||||
" The use_global and executable options for the relevant program will be used.
|
||||
function! ale#node#FindExecutable(buffer, base_var_name, path_list) abort
|
||||
if ale#Var(a:buffer, a:base_var_name . '_use_global')
|
||||
return ale#Var(a:buffer, a:base_var_name . '_executable')
|
||||
endif
|
||||
|
||||
let l:nearest = ale#node#FindNearestExecutable(a:buffer, a:path_list)
|
||||
|
||||
if !empty(l:nearest)
|
||||
return l:nearest
|
||||
endif
|
||||
|
||||
return ale#Var(a:buffer, a:base_var_name . '_executable')
|
||||
endfunction
|
||||
|
||||
" Given a buffer number, a base variable name, and a list of paths to search
|
||||
" for in ancestor directories, detect the executable path for a Node program.
|
||||
function! ale#node#FindNearestExecutable(buffer, path_list) abort
|
||||
for l:path in a:path_list
|
||||
let l:executable = ale#path#FindNearestFile(a:buffer, l:path)
|
||||
|
||||
if !empty(l:executable)
|
||||
return l:executable
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Create a executable string which executes a Node.js script command with a
|
||||
" Node.js executable if needed.
|
||||
"
|
||||
|
@ -77,6 +77,42 @@ function! ale#path#ResolveLocalPath(buffer, search_string, global_fallback) abor
|
||||
return l:path
|
||||
endfunction
|
||||
|
||||
" Given a buffer number, a base variable name, and a list of paths to search
|
||||
" for in ancestor directories, detect the executable path for a program.
|
||||
function! ale#path#FindNearestExecutable(buffer, path_list) abort
|
||||
for l:path in a:path_list
|
||||
if ale#path#IsAbsolute(l:path)
|
||||
let l:executable = filereadable(l:path) ? l:path : ''
|
||||
else
|
||||
let l:executable = ale#path#FindNearestFile(a:buffer, l:path)
|
||||
endif
|
||||
|
||||
if !empty(l:executable)
|
||||
return l:executable
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Given a buffer number, a base variable name, and a list of paths to search
|
||||
" for in ancestor directories, detect the executable path for a program.
|
||||
"
|
||||
" The use_global and executable options for the relevant program will be used.
|
||||
function! ale#path#FindExecutable(buffer, base_var_name, path_list) abort
|
||||
if ale#Var(a:buffer, a:base_var_name . '_use_global')
|
||||
return ale#Var(a:buffer, a:base_var_name . '_executable')
|
||||
endif
|
||||
|
||||
let l:nearest = ale#path#FindNearestExecutable(a:buffer, a:path_list)
|
||||
|
||||
if !empty(l:nearest)
|
||||
return l:nearest
|
||||
endif
|
||||
|
||||
return ale#Var(a:buffer, a:base_var_name . '_executable')
|
||||
endfunction
|
||||
|
||||
" Return 1 if a path is an absolute path.
|
||||
function! ale#path#IsAbsolute(filename) abort
|
||||
if has('win32') && a:filename[:0] is# '\'
|
||||
|
@ -203,6 +203,27 @@ function! ale#sign#ParsePattern() abort
|
||||
return l:pattern
|
||||
endfunction
|
||||
|
||||
" Given a buffer number, return a List of placed signs [line, id, group]
|
||||
function! ale#sign#ParseSignsWithGetPlaced(buffer) abort
|
||||
let l:signs = sign_getplaced(a:buffer, { 'group': s:supports_sign_groups ? 'ale' : '' })[0].signs
|
||||
let l:result = []
|
||||
let l:is_dummy_sign_set = 0
|
||||
|
||||
for l:sign in l:signs
|
||||
if l:sign['name'] is# 'ALEDummySign'
|
||||
let l:is_dummy_sign_set = 1
|
||||
else
|
||||
call add(l:result, [
|
||||
\ str2nr(l:sign['lnum']),
|
||||
\ str2nr(l:sign['id']),
|
||||
\ l:sign['name'],
|
||||
\])
|
||||
endif
|
||||
endfor
|
||||
|
||||
return [l:is_dummy_sign_set, l:result]
|
||||
endfunction
|
||||
|
||||
" Given a list of lines for sign output, return a List of [line, id, group]
|
||||
function! ale#sign#ParseSigns(line_list) abort
|
||||
let l:pattern =ale#sign#ParsePattern()
|
||||
@ -229,9 +250,13 @@ function! ale#sign#ParseSigns(line_list) abort
|
||||
endfunction
|
||||
|
||||
function! ale#sign#FindCurrentSigns(buffer) abort
|
||||
let l:line_list = ale#sign#ReadSigns(a:buffer)
|
||||
if exists('*sign_getplaced')
|
||||
return ale#sign#ParseSignsWithGetPlaced(a:buffer)
|
||||
else
|
||||
let l:line_list = ale#sign#ReadSigns(a:buffer)
|
||||
|
||||
return ale#sign#ParseSigns(l:line_list)
|
||||
return ale#sign#ParseSigns(l:line_list)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Given a loclist, group the List into with one List per line.
|
||||
|
Reference in New Issue
Block a user