mirror of
https://github.com/amix/vimrc
synced 2025-07-12 14:15:00 +08:00
Updated plugins
This commit is contained in:
@ -1002,7 +1002,7 @@ endfunction
|
||||
function! ale#completion#HandleUserData(completed_item) abort
|
||||
let l:user_data_json = get(a:completed_item, 'user_data', '')
|
||||
let l:user_data = !empty(l:user_data_json)
|
||||
\ ? json_decode(l:user_data_json)
|
||||
\ ? ale#util#FuzzyJSONDecode(l:user_data_json, v:null)
|
||||
\ : v:null
|
||||
|
||||
if type(l:user_data) isnot v:t_dict
|
||||
|
@ -17,6 +17,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['python'],
|
||||
\ 'description': 'Fix import issues with autoimport.',
|
||||
\ },
|
||||
\ 'autoflake': {
|
||||
\ 'function': 'ale#fixers#autoflake#Fix',
|
||||
\ 'suggested_filetypes': ['python'],
|
||||
\ 'description': 'Fix flake issues with autoflake.',
|
||||
\ },
|
||||
\ 'autopep8': {
|
||||
\ 'function': 'ale#fixers#autopep8#Fix',
|
||||
\ 'suggested_filetypes': ['python'],
|
||||
@ -376,6 +381,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['dart'],
|
||||
\ 'description': 'Fix Dart files with dartfmt.',
|
||||
\ },
|
||||
\ 'dart-format': {
|
||||
\ 'function': 'ale#fixers#dart_format#Fix',
|
||||
\ 'suggested_filetypes': ['dart'],
|
||||
\ 'description': 'Fix Dart files with dart format.',
|
||||
\ },
|
||||
\ 'xmllint': {
|
||||
\ 'function': 'ale#fixers#xmllint#Fix',
|
||||
\ 'suggested_filetypes': ['xml'],
|
||||
@ -441,6 +451,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['html', 'htmldjango'],
|
||||
\ 'description': 'Fix HTML files with html-beautify.',
|
||||
\ },
|
||||
\ 'lua-format': {
|
||||
\ 'function': 'ale#fixers#lua_format#Fix',
|
||||
\ 'suggested_filetypes': ['lua'],
|
||||
\ 'description': 'Fix Lua files with lua-format.',
|
||||
\ },
|
||||
\ 'luafmt': {
|
||||
\ 'function': 'ale#fixers#luafmt#Fix',
|
||||
\ 'suggested_filetypes': ['lua'],
|
||||
|
28
sources_non_forked/ale/autoload/ale/fixers/autoflake.vim
Normal file
28
sources_non_forked/ale/autoload/ale/fixers/autoflake.vim
Normal file
@ -0,0 +1,28 @@
|
||||
" Author: circld <circld1@gmail.com>
|
||||
" Description: Fixing files with autoflake.
|
||||
|
||||
call ale#Set('python_autoflake_executable', 'autoflake')
|
||||
call ale#Set('python_autoflake_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_autoflake_options', '')
|
||||
|
||||
function! ale#fixers#autoflake#Fix(buffer) abort
|
||||
let l:executable = ale#python#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'python_autoflake',
|
||||
\ ['autoflake'],
|
||||
\)
|
||||
|
||||
if !executable(l:executable)
|
||||
return 0
|
||||
endif
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'python_autoflake_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --in-place '
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
@ -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_auto_poetry', 0)
|
||||
call ale#Set('python_black_change_directory', 1)
|
||||
|
||||
function! ale#fixers#black#GetExecutable(buffer) abort
|
||||
@ -13,6 +14,11 @@ function! ale#fixers#black#GetExecutable(buffer) abort
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_black_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_black', ['black'])
|
||||
endfunction
|
||||
|
||||
@ -20,7 +26,7 @@ function! ale#fixers#black#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#black#GetExecutable(a:buffer)
|
||||
let l:cmd = [ale#Escape(l:executable)]
|
||||
|
||||
if l:executable =~? 'pipenv$'
|
||||
if l:executable =~? 'pipenv\|poetry$'
|
||||
call extend(l:cmd, ['run', 'black'])
|
||||
endif
|
||||
|
||||
|
18
sources_non_forked/ale/autoload/ale/fixers/dart_format.vim
Normal file
18
sources_non_forked/ale/autoload/ale/fixers/dart_format.vim
Normal file
@ -0,0 +1,18 @@
|
||||
" Author: ghsang <gwonhyuksang@gmail.com>
|
||||
" Description: Integration of dart format with ALE.
|
||||
|
||||
call ale#Set('dart_format_executable', 'dart')
|
||||
call ale#Set('dart_format_options', '')
|
||||
|
||||
function! ale#fixers#dart_format#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'dart_format_executable')
|
||||
let l:options = ale#Var(a:buffer, 'dart_format_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' format'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
@ -29,6 +29,7 @@ function! ale#fixers#isort#Fix(buffer) abort
|
||||
return {
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#Escape(l:executable) . l:exec_args
|
||||
\ . ale#Pad('--filename %s')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' -',
|
||||
\}
|
||||
endfunction
|
||||
|
16
sources_non_forked/ale/autoload/ale/fixers/lua_format.vim
Normal file
16
sources_non_forked/ale/autoload/ale/fixers/lua_format.vim
Normal file
@ -0,0 +1,16 @@
|
||||
" Author: Mathias Jean Johansen <mathias@mjj.io>
|
||||
" Description: Integration of LuaFormatter with ALE.
|
||||
|
||||
call ale#Set('lua_lua_format_executable', 'lua-format')
|
||||
call ale#Set('lua_lua_format_options', '')
|
||||
|
||||
function! ale#fixers#lua_format#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'lua_lua_format_executable')
|
||||
let l:options = ale#Var(a:buffer, 'lua_lua_format_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' -i',
|
||||
\}
|
||||
endfunction
|
@ -1,26 +1,35 @@
|
||||
" Author: Jan-Grimo Sobez <jan-grimo.sobez@phys.chem.ethz.ch>
|
||||
" Author: Kevin Clark <kevin.clark@gmail.com>
|
||||
" Author: D. Ben Knoble <ben.knoble+github@gmail.com>
|
||||
" Description: Floating preview window for showing whatever information in.
|
||||
|
||||
" Precondition: exists('*nvim_open_win')
|
||||
" Precondition: exists('*nvim_open_win') || has('popupwin')
|
||||
|
||||
function! ale#floating_preview#Show(lines, ...) abort
|
||||
if !exists('*nvim_open_win')
|
||||
if !exists('*nvim_open_win') && !has('popupwin')
|
||||
execute 'echom ''Floating windows not supported in this vim instance.'''
|
||||
|
||||
return
|
||||
endif
|
||||
|
||||
let l:options = get(a:000, 0, {})
|
||||
|
||||
if has('nvim')
|
||||
call s:NvimShow(a:lines, l:options)
|
||||
else
|
||||
call s:VimShow(a:lines, l:options)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:NvimShow(lines, options) abort
|
||||
" Remove the close autocmd so it doesn't happen mid update
|
||||
augroup ale_floating_preview_window
|
||||
autocmd!
|
||||
augroup END
|
||||
|
||||
let l:options = get(a:000, 0, {})
|
||||
|
||||
" Only create a new window if we need it
|
||||
if !exists('w:preview') || index(nvim_list_wins(), w:preview['id']) is# -1
|
||||
call s:Create(l:options)
|
||||
call s:NvimCreate(a:options)
|
||||
else
|
||||
call nvim_buf_set_option(w:preview['buffer'], 'modifiable', v:true)
|
||||
endif
|
||||
@ -30,7 +39,7 @@ function! ale#floating_preview#Show(lines, ...) abort
|
||||
|
||||
call nvim_set_current_win(w:preview['id'])
|
||||
|
||||
for l:command in get(l:options, 'commands', [])
|
||||
for l:command in get(a:options, 'commands', [])
|
||||
call execute(l:command)
|
||||
endfor
|
||||
|
||||
@ -41,13 +50,13 @@ function! ale#floating_preview#Show(lines, ...) abort
|
||||
autocmd!
|
||||
|
||||
if g:ale_close_preview_on_insert
|
||||
autocmd CursorMoved,TabLeave,WinLeave,InsertEnter <buffer> ++once call s:Close()
|
||||
autocmd CursorMoved,TabLeave,WinLeave,InsertEnter <buffer> ++once call s:NvimClose()
|
||||
else
|
||||
autocmd CursorMoved,TabLeave,WinLeave <buffer> ++once call s:Close()
|
||||
autocmd CursorMoved,TabLeave,WinLeave <buffer> ++once call s:NvimClose()
|
||||
endif
|
||||
augroup END
|
||||
|
||||
let [l:lines, l:width, l:height] = s:PrepareWindowContent(a:lines)
|
||||
let [l:lines, l:width, l:height] = s:NvimPrepareWindowContent(a:lines)
|
||||
|
||||
call nvim_win_set_width(w:preview['id'], l:width)
|
||||
call nvim_win_set_height(w:preview['id'], l:height)
|
||||
@ -56,7 +65,33 @@ function! ale#floating_preview#Show(lines, ...) abort
|
||||
call nvim_buf_set_option(w:preview['buffer'], 'modifiable', v:false)
|
||||
endfunction
|
||||
|
||||
function! s:PrepareWindowContent(lines) abort
|
||||
function! s:VimShow(lines, options) abort
|
||||
if g:ale_close_preview_on_insert
|
||||
" Remove the close autocmd so it doesn't happen mid update
|
||||
silent! autocmd! ale_floating_preview_window
|
||||
endif
|
||||
|
||||
" Only create a new window if we need it
|
||||
if !exists('w:preview') || index(popup_list(), w:preview['id']) is# -1
|
||||
call s:VimCreate(a:options)
|
||||
endif
|
||||
|
||||
" Execute commands in window context
|
||||
for l:command in get(a:options, 'commands', [])
|
||||
call win_execute(w:preview['id'], l:command)
|
||||
endfor
|
||||
|
||||
call popup_settext(w:preview['id'], a:lines)
|
||||
|
||||
if g:ale_close_preview_on_insert
|
||||
augroup ale_floating_preview_window
|
||||
autocmd!
|
||||
autocmd InsertEnter * ++once call s:VimClose()
|
||||
augroup END
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:NvimPrepareWindowContent(lines) abort
|
||||
let l:max_height = 10
|
||||
|
||||
let l:width = max(map(copy(a:lines), 'strdisplaywidth(v:val)'))
|
||||
@ -94,7 +129,7 @@ function! s:PrepareWindowContent(lines) abort
|
||||
return [l:lines, l:width, l:height]
|
||||
endfunction
|
||||
|
||||
function! s:Create(options) abort
|
||||
function! s:NvimCreate(options) abort
|
||||
let l:buffer = nvim_create_buf(v:false, v:false)
|
||||
let l:winid = nvim_open_win(l:buffer, v:false, {
|
||||
\ 'relative': 'cursor',
|
||||
@ -112,7 +147,32 @@ function! s:Create(options) abort
|
||||
let w:preview = {'id': l:winid, 'buffer': l:buffer}
|
||||
endfunction
|
||||
|
||||
function! s:Close() abort
|
||||
function! s:VimCreate(options) abort
|
||||
let l:popup_id = popup_create([], {
|
||||
\ 'line': 'cursor+1',
|
||||
\ 'col': 'cursor',
|
||||
\ 'drag': v:true,
|
||||
\ 'resize': v:true,
|
||||
\ 'close': 'button',
|
||||
\ 'padding': [0, 1, 0, 1],
|
||||
\ 'border': [],
|
||||
\ 'borderchars': empty(g:ale_floating_window_border) ? [' '] : [
|
||||
\ g:ale_floating_window_border[1],
|
||||
\ g:ale_floating_window_border[0],
|
||||
\ g:ale_floating_window_border[1],
|
||||
\ g:ale_floating_window_border[0],
|
||||
\ g:ale_floating_window_border[2],
|
||||
\ g:ale_floating_window_border[3],
|
||||
\ g:ale_floating_window_border[4],
|
||||
\ g:ale_floating_window_border[5],
|
||||
\ ],
|
||||
\ 'moved': 'any',
|
||||
\ })
|
||||
call setbufvar(winbufnr(l:popup_id), '&filetype', get(a:options, 'filetype', 'ale-preview'))
|
||||
let w:preview = {'id': l:popup_id}
|
||||
endfunction
|
||||
|
||||
function! s:NvimClose() abort
|
||||
let l:mode = mode()
|
||||
let l:restore_visual = l:mode is# 'v' || l:mode is# 'V' || l:mode is# "\<C-V>"
|
||||
|
||||
@ -132,3 +192,12 @@ function! s:Close() abort
|
||||
normal! gv
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:VimClose() abort
|
||||
if !exists('w:preview')
|
||||
return
|
||||
endif
|
||||
|
||||
call popup_close(w:preview['id'])
|
||||
unlet w:preview
|
||||
endfunction
|
||||
|
@ -1,8 +1,10 @@
|
||||
" Author: Mohammed Chelouti - https://github.com/motato1
|
||||
" Arnold Chand <creativenull@outlook.com>
|
||||
" Description: Handler functions for Deno.
|
||||
|
||||
call ale#Set('deno_executable', 'deno')
|
||||
call ale#Set('deno_unstable', 0)
|
||||
call ale#Set('deno_importMap', 'import_map.json')
|
||||
call ale#Set('deno_lsp_project_root', '')
|
||||
|
||||
function! ale#handlers#deno#GetExecutable(buffer) abort
|
||||
@ -50,3 +52,23 @@ function! ale#handlers#deno#GetProjectRoot(buffer) abort
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" Initialization Options for deno, for javascript and typescript
|
||||
function! ale#handlers#deno#GetInitializationOptions(buffer) abort
|
||||
let l:options = {
|
||||
\ 'enable': v:true,
|
||||
\ 'lint': v:true,
|
||||
\ 'unstable': v:false,
|
||||
\ 'importMap': ale#path#FindNearestFile(a:buffer, 'import_map.json'),
|
||||
\ }
|
||||
|
||||
if ale#Var(a:buffer, 'deno_unstable')
|
||||
let l:options.unstable = v:true
|
||||
endif
|
||||
|
||||
if ale#Var(a:buffer, 'deno_importMap') isnot# ''
|
||||
let l:options.importMap = ale#path#FindNearestFile(a:buffer, ale#Var(a:buffer, 'deno_importMap'))
|
||||
endif
|
||||
|
||||
return l:options
|
||||
endfunction
|
||||
|
@ -2,6 +2,7 @@
|
||||
" Description: Functions for integrating with Python linters.
|
||||
|
||||
call ale#Set('python_auto_pipenv', '0')
|
||||
call ale#Set('python_auto_poetry', '0')
|
||||
|
||||
let s:sep = has('win32') ? '\' : '/'
|
||||
" bin is used for Unix virtualenv directories, and Scripts is for Windows.
|
||||
@ -34,6 +35,7 @@ function! ale#python#FindProjectRootIni(buffer) abort
|
||||
\|| filereadable(l:path . '/Pipfile.lock')
|
||||
\|| filereadable(l:path . '/poetry.lock')
|
||||
\|| filereadable(l:path . '/pyproject.toml')
|
||||
\|| filereadable(l:path . '/.tool-versions')
|
||||
return l:path
|
||||
endif
|
||||
endfor
|
||||
@ -157,3 +159,8 @@ endfunction
|
||||
function! ale#python#PipenvPresent(buffer) abort
|
||||
return findfile('Pipfile.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# ''
|
||||
endfunction
|
||||
|
||||
" Detects whether a poetry environment is present.
|
||||
function! ale#python#PoetryPresent(buffer) abort
|
||||
return findfile('poetry.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# ''
|
||||
endfunction
|
||||
|
12
sources_non_forked/ale/autoload/ale/racket.vim
Normal file
12
sources_non_forked/ale/autoload/ale/racket.vim
Normal file
@ -0,0 +1,12 @@
|
||||
function! ale#racket#FindProjectRoot(buffer) abort
|
||||
let l:cwd = expand('#' . a:buffer . ':p:h')
|
||||
let l:highest_init = l:cwd
|
||||
|
||||
for l:path in ale#path#Upwards(l:cwd)
|
||||
if filereadable(l:path.'/init.rkt')
|
||||
let l:highest_init = l:path
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:highest_init
|
||||
endfunction
|
@ -85,7 +85,7 @@ execute 'sign define ALEStyleWarningSign text=' . s:EscapeSignText(g:ale_sign_st
|
||||
\ . ' texthl=ALEStyleWarningSign linehl=ALEWarningLine'
|
||||
execute 'sign define ALEInfoSign text=' . s:EscapeSignText(g:ale_sign_info)
|
||||
\ . ' texthl=ALEInfoSign linehl=ALEInfoLine'
|
||||
sign define ALEDummySign
|
||||
sign define ALEDummySign text=\ texthl=SignColumn
|
||||
|
||||
if g:ale_sign_highlight_linenrs && has('nvim-0.3.2')
|
||||
if !hlexists('ALEErrorSignLineNr')
|
||||
|
Reference in New Issue
Block a user