mirror of
https://github.com/amix/vimrc
synced 2025-08-07 22:35:01 +08:00
Updated plugins
This commit is contained in:
@ -5,6 +5,7 @@ call ale#Set('python_black_executable', 'black')
|
||||
call ale#Set('python_black_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_black_options', '')
|
||||
call ale#Set('python_black_auto_pipenv', 0)
|
||||
call ale#Set('python_black_change_directory', 1)
|
||||
|
||||
function! ale#fixers#black#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_black_auto_pipenv'))
|
||||
@ -16,6 +17,10 @@ function! ale#fixers#black#GetExecutable(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#black#Fix(buffer) abort
|
||||
let l:cd_string = ale#Var(a:buffer, 'python_black_change_directory')
|
||||
\ ? ale#path#BufferCdString(a:buffer)
|
||||
\ : ''
|
||||
|
||||
let l:executable = ale#fixers#black#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
@ -25,7 +30,7 @@ function! ale#fixers#black#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'python_black_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . l:exec_args
|
||||
\ 'command': l:cd_string . ale#Escape(l:executable) . l:exec_args
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -',
|
||||
\}
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Generic functions for fixing files with.
|
||||
|
||||
function! ale#fixers#generic#RemoveTrailingBlankLines(buffer, done, lines) abort
|
||||
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])
|
||||
@ -12,7 +12,7 @@ function! ale#fixers#generic#RemoveTrailingBlankLines(buffer, done, lines) abort
|
||||
endfunction
|
||||
|
||||
" Remove all whitespaces at the end of lines
|
||||
function! ale#fixers#generic#TrimWhitespace(buffer, done, lines) abort
|
||||
function! ale#fixers#generic#TrimWhitespace(buffer, lines) abort
|
||||
let l:index = 0
|
||||
let l:lines_new = range(len(a:lines))
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
" Description: Generic fixer functions for Python.
|
||||
|
||||
" Add blank lines before control statements.
|
||||
function! ale#fixers#generic_python#AddLinesBeforeControlStatements(buffer, done, lines) abort
|
||||
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
|
||||
@ -41,7 +41,7 @@ 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, done, lines) abort
|
||||
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')
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Generic fixer functions for Vim help documents.
|
||||
|
||||
function! ale#fixers#help#AlignTags(buffer, done, lines) abort
|
||||
function! ale#fixers#help#AlignTags(buffer, lines) abort
|
||||
let l:new_lines = []
|
||||
|
||||
for l:line in a:lines
|
||||
|
@ -7,16 +7,16 @@ function! ale#fixers#jq#GetExecutable(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#jq#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'json_jq_options')
|
||||
let l:filters = ale#Var(a:buffer, 'json_jq_filters')
|
||||
let l:options = ale#Var(a:buffer, 'json_jq_options')
|
||||
let l:filters = ale#Var(a:buffer, 'json_jq_filters')
|
||||
|
||||
if empty(l:filters)
|
||||
return 0
|
||||
endif
|
||||
if empty(l:filters)
|
||||
return 0
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#jq#GetExecutable(a:buffer))
|
||||
\ . ' ' . l:filters . ' '
|
||||
\ . l:options,
|
||||
\}
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#jq#GetExecutable(a:buffer))
|
||||
\ . ' ' . l:filters . ' '
|
||||
\ . l:options,
|
||||
\}
|
||||
endfunction
|
||||
|
@ -47,6 +47,15 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort
|
||||
" Append the --parser flag depending on the current filetype (unless it's
|
||||
" already set in g:javascript_prettier_options).
|
||||
if empty(expand('#' . a:buffer . ':e')) && match(l:options, '--parser') == -1
|
||||
" Mimic Prettier's defaults. In cases without a file extension or
|
||||
" filetype (scratch buffer), Prettier needs `parser` set to know how
|
||||
" to process the buffer.
|
||||
if ale#semver#GTE(l:version, [1, 16, 0])
|
||||
let l:parser = 'babel'
|
||||
else
|
||||
let l:parser = 'babylon'
|
||||
endif
|
||||
|
||||
let l:prettier_parsers = {
|
||||
\ 'typescript': 'typescript',
|
||||
\ 'css': 'css',
|
||||
@ -60,7 +69,6 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort
|
||||
\ 'yaml': 'yaml',
|
||||
\ 'html': 'html',
|
||||
\}
|
||||
let l:parser = ''
|
||||
|
||||
for l:filetype in split(getbufvar(a:buffer, '&filetype'), '\.')
|
||||
if has_key(l:prettier_parsers, l:filetype)
|
||||
|
@ -5,7 +5,7 @@ function! ale#fixers#qmlfmt#GetExecutable(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#qmlfmt#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#qmlfmt#GetExecutable(a:buffer)),
|
||||
\}
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#qmlfmt#GetExecutable(a:buffer)),
|
||||
\}
|
||||
endfunction
|
||||
|
@ -5,13 +5,12 @@ call ale#Set('stylelint_executable', 'stylelint')
|
||||
call ale#Set('stylelint_use_global', get(g:, 'ale_use_global_executables', 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',
|
||||
\])
|
||||
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)
|
||||
|
||||
|
Reference in New Issue
Block a user