1
0
mirror of https://github.com/amix/vimrc synced 2025-06-30 20:05:01 +08:00

Updated plugins

This commit is contained in:
Amir
2021-07-04 22:47:44 +02:00
parent 597b7acdc0
commit e19ae5588a
28 changed files with 297 additions and 103 deletions

View File

@ -3,7 +3,7 @@
call ale#Set('go_staticcheck_executable', 'staticcheck')
call ale#Set('go_staticcheck_options', '')
call ale#Set('go_staticcheck_lint_package', 0)
call ale#Set('go_staticcheck_lint_package', 1)
call ale#Set('go_staticcheck_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#go#staticcheck#GetCommand(buffer) abort

View File

@ -14,6 +14,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'type': l:match[1] is? 'WARN' ? 'W' : 'E',
\ 'sub_type': 'style',
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'text': l:match[4],
@ -31,6 +32,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'type': l:match[3] is? 'warning' ? 'W' : 'E',
\ 'sub_type': 'style',
\ 'lnum': l:match[2] + 0,
\ 'text': l:match[4],
\})

View File

@ -20,8 +20,9 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon')
let l:dist_config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
if empty(l:level) && empty(l:config_file_exists)
if empty(l:level) && empty(l:config_file_exists) && empty(l:dist_config_file_exists)
" if no configuration file is found, then use 4 as a default level
let l:level = '4'
endif

View File

@ -1,4 +1,5 @@
" Author: Eric Zhao <21zhaoe@protonmail.com>
" Author: ourigen <https://github.com/ourigen>
" Description: Implementation of the Language Server Protocol for R.
call ale#Set('r_languageserver_cmd', 'languageserver::run()')
@ -7,7 +8,7 @@ call ale#Set('r_languageserver_config', {})
function! ale_linters#r#languageserver#GetCommand(buffer) abort
let l:cmd_string = ale#Var(a:buffer, 'r_languageserver_cmd')
return 'Rscript --vanilla -e ' . ale#Escape(l:cmd_string)
return 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' . ale#Escape(l:cmd_string)
endfunction
function! ale_linters#r#languageserver#GetProjectRoot(buffer) abort

View File

@ -14,6 +14,7 @@ function! ale_linters#racket#raco#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'filename': l:match[2],
\ 'lnum': l:match[3] + 0,
\ 'col': l:match[4] + 0,
\ 'type': 'E',

View File

@ -1,34 +1,52 @@
" Author: Karl Bartel <karl42@gmail.com> - http://karl.berlin/
" Description: Report solc compiler errors in Solidity code
call ale#Set('solidity_solc_executable', 'solc')
call ale#Set('solidity_solc_options', '')
function! ale_linters#solidity#solc#Handle(buffer, lines) abort
" Matches patterns like the following:
" /path/to/file/file.sol:1:10: Error: Identifier not found or not unique.
let l:pattern = '\v^[^:]+:(\d+):(\d+): (Error|Warning): (.*)$'
" Error: Expected ';' but got '('
" --> /path/to/file/file.sol:1:10:)
let l:pattern = '\v(Error|Warning): (.*)$'
let l:line_and_column_pattern = '\v\.sol:(\d+):(\d+):'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:isError = l:match[3] is? 'error'
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[4],
\ 'type': l:isError ? 'E' : 'W',
\})
for l:line in a:lines
let l:match = matchlist(l:line, l:pattern)
if len(l:match) == 0
let l:match = matchlist(l:line, l:line_and_column_pattern)
if len(l:match) > 0
let l:index = len(l:output) - 1
let l:output[l:index]['lnum'] = l:match[1] + 0
let l:output[l:index]['col'] = l:match[2] + 0
endif
else
let l:isError = l:match[1] is? 'Error'
call add(l:output, {
\ 'lnum': 0,
\ 'col': 0,
\ 'text': l:match[2],
\ 'type': l:isError ? 'E' : 'W',
\})
endif
endfor
return l:output
endfunction
function! ale_linters#solidity#solc#GetCommand(buffer) abort
return 'solc' . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s'
let l:executable = ale#Var(a:buffer, 'solidity_solc_executable')
return l:executable . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s'
endfunction
call ale#linter#Define('solidity', {
\ 'name': 'solc',
\ 'executable': 'solc',
\ 'executable': {b -> ale#Var(b, 'solidity_solc_executable')},
\ 'command': function('ale_linters#solidity#solc#GetCommand'),
\ 'callback': 'ale_linters#solidity#solc#Handle',
\ 'output_stream': 'stderr',

View File

@ -29,11 +29,18 @@
call ale#Set('spec_rpmlint_executable', 'rpmlint')
call ale#Set('spec_rpmlint_options', '')
function! ale_linters#spec#rpmlint#GetCommand(buffer) abort
function! ale_linters#spec#rpmlint#GetCommand(buffer, version) abort
if ale#semver#GTE(a:version, [2, 0, 0])
" The -o/--option flag was removed in version 2.0.0
let l:version_dependent_args = ''
else
let l:version_dependent_args = ' -o "NetworkEnabled False"'
endif
return '%e'
\ . ale#Pad(ale#Var(a:buffer, 'spec_rpmlint_options'))
\ . ' -o "NetworkEnabled False"'
\ . ' -v'
\ . l:version_dependent_args
\ . ' %t'
endfunction
@ -73,6 +80,11 @@ endfunction
call ale#linter#Define('spec', {
\ 'name': 'rpmlint',
\ 'executable': {b -> ale#Var(b, 'spec_rpmlint_executable')},
\ 'command': function('ale_linters#spec#rpmlint#GetCommand'),
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale#Var(buffer, 'spec_rpmlint_executable'),
\ '%e --version',
\ function('ale_linters#spec#rpmlint#GetCommand'),
\ )},
\ 'callback': 'ale_linters#spec#rpmlint#Handle',
\})

View File

@ -151,8 +151,6 @@ function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort
\ || stridx(l:option, '-isystem') == 0
\ || stridx(l:option, '-idirafter') == 0
\ || stridx(l:option, '-iframework') == 0
\ || stridx(l:option, '-include') == 0
\ || stridx(l:option, '-imacros') == 0
if stridx(l:option, '-I') == 0 && l:option isnot# '-I'
let l:arg = join(split(l:option, '\zs')[2:], '')
let l:option = '-I'
@ -182,6 +180,7 @@ function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort
" Options that have an argument (always separate)
elseif l:option is# '-iprefix' || stridx(l:option, '-iwithprefix') == 0
\ || l:option is# '-isysroot' || l:option is# '-imultilib'
\ || l:option is# '-include' || l:option is# '-imacros'
call add(l:items, [0, l:option])
call add(l:items, [0, l:arguments[l:option_index]])
let l:option_index = l:option_index + 1

View File

@ -316,6 +316,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['reason'],
\ 'description': 'Fix ReasonML files with refmt.',
\ },
\ 'pandoc': {
\ 'function': 'ale#fixers#pandoc#Fix',
\ 'suggested_filetypes': ['markdown'],
\ 'description': 'Fix markdown files with pandoc.',
\ },
\ 'shfmt': {
\ 'function': 'ale#fixers#shfmt#Fix',
\ 'suggested_filetypes': ['sh'],
@ -441,6 +446,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['lua'],
\ 'description': 'Fix Lua files with luafmt.',
\ },
\ 'stylua': {
\ 'function': 'ale#fixers#stylua#Fix',
\ 'suggested_filetypes': ['lua'],
\ 'description': 'Fix Lua files with stylua.',
\ },
\ 'ormolu': {
\ 'function': 'ale#fixers#ormolu#Fix',
\ 'suggested_filetypes': ['haskell'],

View File

@ -18,20 +18,25 @@ endfunction
function! ale#fixers#black#Fix(buffer) abort
let l:executable = ale#fixers#black#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv$'
\ ? ' run black'
\ : ''
let l:options = ale#Var(a:buffer, 'python_black_options')
let l:cmd = [ale#Escape(l:executable)]
if expand('#' . a:buffer . ':e') is? 'pyi'
let l:options .= '--pyi'
if l:executable =~? 'pipenv$'
call extend(l:cmd, ['run', 'black'])
endif
let l:result = {
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -',
\}
let l:options = ale#Var(a:buffer, 'python_black_options')
if !empty(l:options)
call add(l:cmd, l:options)
endif
if expand('#' . a:buffer . ':e') is? 'pyi'
call add(l:cmd, '--pyi')
endif
call add(l:cmd, '-')
let l:result = {'command': join(l:cmd, ' ')}
if ale#Var(a:buffer, 'python_black_change_directory')
let l:result.cwd = '%s:h'

View File

@ -0,0 +1,16 @@
scriptencoding utf-8
" Author: Jesse Hathaway <jesse@mbuki-mvuki.org>
" Description: Fix markdown files with pandoc.
call ale#Set('markdown_pandoc_executable', 'pandoc')
call ale#Set('markdown_pandoc_options', '-f gfm -t gfm -s -')
function! ale#fixers#pandoc#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'markdown_pandoc_executable')
let l:options = ale#Var(a:buffer, 'markdown_pandoc_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' ' . l:options,
\}
endfunction

View File

@ -0,0 +1,14 @@
" Author: Robert Liebowitz <rliebz@gmail.com>
" Description: https://github.com/johnnymorganz/stylua
call ale#Set('lua_stylua_executable', 'stylua')
call ale#Set('lua_stylua_options', '')
function! ale#fixers#stylua#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'lua_stylua_executable')
let l:options = ale#Var(a:buffer, 'lua_stylua_options')
return {
\ 'command': ale#Escape(l:executable) . ale#Pad(l:options) . ' -',
\}
endfunction

View File

@ -44,6 +44,15 @@ function! s:ShouldOpen(buffer) abort
return l:val is 1 || (l:val is# 'on_save' && l:saved)
endfunction
function! s:Deduplicate(list) abort
let l:list = a:list
call sort(l:list, function('ale#util#LocItemCompareWithText'))
call uniq(l:list, function('ale#util#LocItemCompareWithText'))
return l:list
endfunction
function! ale#list#GetCombinedList() abort
let l:list = []
@ -51,10 +60,7 @@ function! ale#list#GetCombinedList() abort
call extend(l:list, l:info.loclist)
endfor
call sort(l:list, function('ale#util#LocItemCompareWithText'))
call uniq(l:list, function('ale#util#LocItemCompareWithText'))
return l:list
return s:Deduplicate(l:list)
endfunction
function! s:FixList(buffer, list) abort
@ -99,11 +105,13 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort
" but it's better than nothing.
let l:ids = s:WinFindBuf(a:buffer)
let l:loclist = s:Deduplicate(a:loclist)
for l:id in l:ids
if has('nvim')
call setloclist(l:id, s:FixList(a:buffer, a:loclist), ' ', l:title)
call setloclist(l:id, s:FixList(a:buffer, l:loclist), ' ', l:title)
else
call setloclist(l:id, s:FixList(a:buffer, a:loclist))
call setloclist(l:id, s:FixList(a:buffer, l:loclist))
call setloclist(l:id, [], 'r', {'title': l:title})
endif
endfor

View File

@ -1,7 +1,7 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: Preview windows for showing whatever information in.
if !has_key(s:, 'last__list')
if !has_key(s:, 'last_list')
let s:last_list = []
endif
@ -89,6 +89,13 @@ function! ale#preview#ShowSelection(item_list, ...) abort
let b:ale_preview_item_list = a:item_list
let b:ale_preview_item_open_in = get(l:options, 'open_in', 'current-buffer')
" Jump to an index for a previous selection, if set.
if has_key(l:options, 'jump_to_index')
let l:pos = getpos('.')
let l:pos[1] = l:options.jump_to_index + 1
call setpos('.', l:pos)
endif
" Remember preview state, so we can repeat it later.
call ale#preview#SetLastSelection(a:item_list, l:options)
endfunction
@ -101,12 +108,16 @@ endfunction
function! s:Open(open_in) abort
let l:item_list = get(b:, 'ale_preview_item_list', [])
let l:item = get(l:item_list, getpos('.')[1] - 1, {})
let l:index = getpos('.')[1] - 1
let l:item = get(l:item_list, l:index, {})
if empty(l:item)
return
endif
" Remember an index to jump to when repeating a selection.
let s:last_options.jump_to_index = l:index
:q!
call ale#util#Open(

View File

@ -46,5 +46,25 @@ g:ale_lua_luafmt_options *g:ale_lua_luafmt_options*
Default: `''`
This variable can be set to pass additional options to the luafmt fixer.
===============================================================================
stylua *ale-lua-stylua*
g:ale_lua_stylua_executable *g:ale_lua_stylua_executable*
*b:ale_lua_stylua_executable*
Type: |String|
Default: `'stylua'`
This variable can be set to use a different executable for stylua.
g:ale_lua_stylua_options *g:ale_lua_stylua_options*
*b:ale_lua_stylua_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to the stylua fixer.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -33,6 +33,25 @@ g:ale_markdown_mdl_options *g:ale_markdown_mdl_options*
This variable can be set to pass additional options to mdl.
===============================================================================
pandoc *ale-markdown-pandoc*
g:ale_markdown_pandoc_executable *g:ale_markdown_pandoc_executable*
*b:ale_markdown_pandoc_executable*
Type: |String|
Default: `'pandoc'`
This variable can be set to specify where to find the pandoc executable
g:ale_markdown_pandoc_options *g:ale_markdown_pandoc_options*
*b:ale_markdown_pandoc_options*
Type: |String|
Default: `'-f gfm -t gfm -s -'`
This variable can be set to change the default options passed to pandoc
===============================================================================
prettier *ale-markdown-prettier*

View File

@ -5,6 +5,12 @@ ALE Solidity Integration *ale-solidity-options*
===============================================================================
solc *ale-solidity-solc*
g:ale_solidity_solc_executable *g:ale_solidity_solc_executable*
*b:ale_solidity_solc_executable*
Type: |String|
Default: `'solc'`
Override the invoked solc binary. For truffle/hardhat binaries.
g:ale_solidity_solc_options *g:ale_solidity_solc_options*
*b:ale_solidity_solc_options*
@ -33,4 +39,3 @@ solium *ale-solidity-solium*
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -288,6 +288,7 @@ Notes:
* `luac`
* `luacheck`
* `luafmt`
* `stylua`
* Mail
* `alex`!!
* `languagetool`!!
@ -300,6 +301,7 @@ Notes:
* `languagetool`!!
* `markdownlint`!!
* `mdl`
* `pandoc`
* `prettier`
* `proselint`
* `redpen`

View File

@ -2843,9 +2843,11 @@ documented in additional help files.
luac..................................|ale-lua-luac|
luacheck..............................|ale-lua-luacheck|
luafmt................................|ale-lua-luafmt|
stylua................................|ale-lua-stylua|
markdown................................|ale-markdown-options|
markdownlint..........................|ale-markdown-markdownlint|
mdl...................................|ale-markdown-mdl|
pandoc................................|ale-markdown-pandoc|
prettier..............................|ale-markdown-prettier|
remark-lint...........................|ale-markdown-remark-lint|
textlint..............................|ale-markdown-textlint|

View File

@ -297,6 +297,7 @@ formatting.
* [luac](https://www.lua.org/manual/5.1/luac.html)
* [luacheck](https://github.com/mpeterv/luacheck)
* [luafmt](https://github.com/trixnz/lua-fmt)
* [stylua](https://github.com/johnnymorganz/stylua)
* Mail
* [alex](https://github.com/wooorm/alex) :floppy_disk:
* [languagetool](https://languagetool.org/) :floppy_disk:
@ -309,6 +310,7 @@ formatting.
* [languagetool](https://languagetool.org/) :floppy_disk:
* [markdownlint](https://github.com/DavidAnson/markdownlint) :floppy_disk:
* [mdl](https://github.com/mivok/markdownlint)
* [pandoc](https://pandoc.org)
* [prettier](https://github.com/prettier/prettier)
* [proselint](http://proselint.com/)
* [redpen](http://redpen.cc/)