mirror of
https://github.com/amix/vimrc
synced 2025-08-07 22:35:01 +08:00
Updated plugins
This commit is contained in:
@ -5,27 +5,13 @@ scriptencoding utf-8
|
||||
call ale#Set('sh_shfmt_executable', 'shfmt')
|
||||
call ale#Set('sh_shfmt_options', '')
|
||||
|
||||
function! s:DefaultOption(buffer) abort
|
||||
if getbufvar(a:buffer, '&expandtab') == 0
|
||||
" Tab is used by default
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:tabsize = getbufvar(a:buffer, '&shiftwidth')
|
||||
|
||||
if l:tabsize == 0
|
||||
let l:tabsize = getbufvar(a:buffer, '&tabstop')
|
||||
endif
|
||||
|
||||
return ' -i ' . l:tabsize
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#shfmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'sh_shfmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'sh_shfmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . (empty(l:options) ? s:DefaultOption(a:buffer) : ' ' . l:options)
|
||||
\ . ' -filename=%s'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\}
|
||||
endfunction
|
||||
|
@ -4,13 +4,30 @@
|
||||
call ale#Set('c_uncrustify_executable', 'uncrustify')
|
||||
call ale#Set('c_uncrustify_options', '')
|
||||
|
||||
let s:languages = {
|
||||
\ 'c': 'C',
|
||||
\ 'cpp': 'CPP',
|
||||
\ 'cs': 'CS',
|
||||
\ 'objc': 'OC',
|
||||
\ 'objcpp': 'OC+',
|
||||
\ 'd': 'D',
|
||||
\ 'java': 'JAVA',
|
||||
\ 'vala': 'VALA',
|
||||
\ 'p': 'PAWN',
|
||||
\}
|
||||
|
||||
function! ale#fixers#uncrustify#Language(buffer) abort
|
||||
return get(s:languages, &filetype, 'C')
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#uncrustify#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'c_uncrustify_executable')
|
||||
let l:options = ale#Var(a:buffer, 'c_uncrustify_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' --no-backup'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' --no-backup '
|
||||
\ . '-l' . ale#Pad(ale#fixers#uncrustify#Language(a:buffer))
|
||||
\ . ale#Pad(l:options)
|
||||
\}
|
||||
endfunction
|
||||
|
Reference in New Issue
Block a user