mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Forgot to add the newly created files from the plugin update
This commit is contained in:
15
sources_non_forked/ale/autoload/ale/fixers/bibclean.vim
Normal file
15
sources_non_forked/ale/autoload/ale/fixers/bibclean.vim
Normal file
@ -0,0 +1,15 @@
|
||||
" Author: Horacio Sanson - https://github.com/hsanson
|
||||
" Description: Support for bibclean fixer for BibTeX files.
|
||||
|
||||
call ale#Set('bib_bibclean_executable', 'bibclean')
|
||||
call ale#Set('bib_bibclean_options', '-align-equals')
|
||||
|
||||
function! ale#fixers#bibclean#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'bib_bibclean_options')
|
||||
let l:executable = ale#Var(a:buffer, 'bib_bibclean_executable')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' ' . (empty(l:options) ? '' : l:options),
|
||||
\}
|
||||
endfunction
|
23
sources_non_forked/ale/autoload/ale/fixers/standardrb.vim
Normal file
23
sources_non_forked/ale/autoload/ale/fixers/standardrb.vim
Normal file
@ -0,0 +1,23 @@
|
||||
" Author: Justin Searls - https://github.com/searls
|
||||
" Description: Fix Ruby files with StandardRB.
|
||||
|
||||
call ale#Set('ruby_standardrb_options', '')
|
||||
call ale#Set('ruby_standardrb_executable', 'standardrb')
|
||||
|
||||
function! ale#fixers#standardrb#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_standardrb_executable')
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, '.standard.yml')
|
||||
let l:options = ale#Var(a:buffer, 'ruby_standardrb_options')
|
||||
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'standardrb')
|
||||
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --fix --force-exclusion %t'
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#standardrb#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#fixers#standardrb#GetCommand(a:buffer),
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
136
sources_non_forked/ale/autoload/ale/virtualtext.vim
Normal file
136
sources_non_forked/ale/autoload/ale/virtualtext.vim
Normal file
@ -0,0 +1,136 @@
|
||||
scriptencoding utf-8
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Author: Luan Santos <cfcluan@gmail.com>
|
||||
" Description: Shows lint message for the current line as virtualtext, if any
|
||||
|
||||
" Controls the milliseconds delay before showing a message.
|
||||
let g:ale_virtualtext_delay = get(g:, 'ale_virtualtext_delay', 10)
|
||||
let s:cursor_timer = -1
|
||||
let s:last_pos = [0, 0, 0]
|
||||
|
||||
if has('nvim-0.3.2')
|
||||
let s:ns_id = nvim_create_namespace('ale')
|
||||
endif
|
||||
|
||||
if !hlexists('ALEVirtualTextError')
|
||||
highlight link ALEVirtualTextError ALEError
|
||||
endif
|
||||
|
||||
if !hlexists('ALEVirtualTextStyleError')
|
||||
highlight link ALEVirtualTextStyleError ALEVirtualTextError
|
||||
endif
|
||||
|
||||
if !hlexists('ALEVirtualTextWarning')
|
||||
highlight link ALEVirtualTextWarning ALEWarning
|
||||
endif
|
||||
|
||||
if !hlexists('ALEVirtualTextStyleWarning')
|
||||
highlight link ALEVirtualTextStyleWarning ALEVirtualTextWarning
|
||||
endif
|
||||
|
||||
if !hlexists('ALEVirtualTextInfo')
|
||||
highlight link ALEVirtualTextInfo ALEVirtualTextWarning
|
||||
endif
|
||||
|
||||
function! ale#virtualtext#Clear() abort
|
||||
if !has('nvim-0.3.2')
|
||||
return
|
||||
endif
|
||||
|
||||
let l:buffer = bufnr('')
|
||||
|
||||
call nvim_buf_clear_highlight(l:buffer, s:ns_id, 0, -1)
|
||||
endfunction
|
||||
|
||||
function! ale#virtualtext#ShowMessage(message, hl_group) abort
|
||||
if !has('nvim-0.3.2')
|
||||
return
|
||||
endif
|
||||
|
||||
let l:cursor_position = getcurpos()
|
||||
let l:line = line('.')
|
||||
let l:buffer = bufnr('')
|
||||
let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ')
|
||||
|
||||
call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:prefix.a:message, a:hl_group]], {})
|
||||
endfunction
|
||||
|
||||
function! s:StopCursorTimer() abort
|
||||
if s:cursor_timer != -1
|
||||
call timer_stop(s:cursor_timer)
|
||||
let s:cursor_timer = -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#virtualtext#ShowCursorWarning(...) abort
|
||||
if !g:ale_virtualtext_cursor
|
||||
return
|
||||
endif
|
||||
|
||||
let l:buffer = bufnr('')
|
||||
|
||||
if mode(1) isnot# 'n'
|
||||
return
|
||||
endif
|
||||
|
||||
if ale#ShouldDoNothing(l:buffer)
|
||||
return
|
||||
endif
|
||||
|
||||
let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer)
|
||||
|
||||
call ale#virtualtext#Clear()
|
||||
|
||||
if !empty(l:loc)
|
||||
let l:msg = get(l:loc, 'detail', l:loc.text)
|
||||
let l:hl_group = 'ALEVirtualTextInfo'
|
||||
let l:type = get(l:loc, 'type', 'E')
|
||||
|
||||
if l:type is# 'E'
|
||||
if get(l:loc, 'sub_type', '') is# 'style'
|
||||
let l:hl_group = 'ALEVirtualTextStyleError'
|
||||
else
|
||||
let l:hl_group = 'ALEVirtualTextError'
|
||||
endif
|
||||
elseif l:type is# 'W'
|
||||
if get(l:loc, 'sub_type', '') is# 'style'
|
||||
let l:hl_group = 'ALEVirtualTextStyleWarning'
|
||||
else
|
||||
let l:hl_group = 'ALEVirtualTextWarning'
|
||||
endif
|
||||
endif
|
||||
|
||||
call ale#virtualtext#ShowMessage(l:msg, l:hl_group)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#virtualtext#ShowCursorWarningWithDelay() abort
|
||||
let l:buffer = bufnr('')
|
||||
|
||||
if !g:ale_virtualtext_cursor
|
||||
return
|
||||
endif
|
||||
|
||||
if mode(1) isnot# 'n'
|
||||
return
|
||||
endif
|
||||
|
||||
call s:StopCursorTimer()
|
||||
|
||||
let l:pos = getcurpos()[0:2]
|
||||
|
||||
" Check the current buffer, line, and column number against the last
|
||||
" recorded position. If the position has actually changed, *then*
|
||||
" we should show something. Otherwise we can end up doing processing
|
||||
" the show message far too frequently.
|
||||
if l:pos != s:last_pos
|
||||
let l:delay = ale#Var(l:buffer, 'virtualtext_delay')
|
||||
|
||||
let s:last_pos = l:pos
|
||||
let s:cursor_timer = timer_start(
|
||||
\ l:delay,
|
||||
\ function('ale#virtualtext#ShowCursorWarning')
|
||||
\)
|
||||
endif
|
||||
endfunction
|
||||
|
Reference in New Issue
Block a user