diff options
author | w0rp <devw0rp@gmail.com> | 2017-04-25 23:52:13 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-04-25 23:52:13 +0100 |
commit | 5d5ba2a7802b67515dd27df80d76b3f265c07624 (patch) | |
tree | ab8224cdc09120b4e4456e9175bc3c8a038fba1d /autoload/ale.vim | |
parent | 45c2d6b580e8e4bfe73412667268c48a3034caf5 (diff) | |
download | ale-5d5ba2a7802b67515dd27df80d76b3f265c07624.zip |
#427 Allow linters and aliases to be configured in buffer local variables
Diffstat (limited to 'autoload/ale.vim')
-rw-r--r-- | autoload/ale.vim | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim index 80ef3eed..b911c215 100644 --- a/autoload/ale.vim +++ b/autoload/ale.vim @@ -3,6 +3,7 @@ " Manages execution of linters when requested by autocommands let s:lint_timer = -1 +let s:queued_buffer_number = -1 let s:should_lint_file_for_buffer = {} " A function for checking various conditions whereby ALE just shouldn't @@ -50,6 +51,7 @@ function! ale#Queue(delay, ...) abort endif if a:delay > 0 + let s:queued_buffer_number = bufnr('%') let s:lint_timer = timer_start(a:delay, function('ale#Lint')) else call ale#Lint() @@ -61,8 +63,14 @@ function! ale#Lint(...) abort return endif - let l:buffer = bufnr('%') - let l:linters = ale#linter#Get(&filetype) + " Get the buffer number linting was queued for. + " or else take the current one. + let l:buffer = len(a:0) > 1 && a:1 == s:lint_timer + \ ? s:queued_buffer_number + \ : bufnr('%') + + " Use the filetype from the buffer + let l:linters = ale#linter#Get(getbufvar(l:buffer, '&filetype')) let l:should_lint_file = 0 " Check if we previously requested checking the file. |