1
0
mirror of https://github.com/amix/vimrc synced 2025-07-12 14:15:00 +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

@ -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(