diff options
author | w0rp <devw0rp@gmail.com> | 2017-06-24 12:24:31 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-06-24 12:24:31 +0100 |
commit | 1ea61162a0c43da9a149b24dc35911cb981fbe7c (patch) | |
tree | a88621586401f17299cd85835f47a8a27d224296 /autoload/ale/events.vim | |
parent | fbf8ccb882eb7819011fa837ea2b4930ed4fa9c7 (diff) | |
download | ale-1ea61162a0c43da9a149b24dc35911cb981fbe7c.zip |
Fix #687 - Check files on enter if they have changed
Diffstat (limited to 'autoload/ale/events.vim')
-rw-r--r-- | autoload/ale/events.vim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/autoload/ale/events.vim b/autoload/ale/events.vim index f8020a16..f740fdaa 100644 --- a/autoload/ale/events.vim +++ b/autoload/ale/events.vim @@ -12,3 +12,22 @@ function! ale#events#SaveEvent() abort call ale#Queue(0, 'lint_file') endif endfunction + +function! s:LintOnEnter() abort + if g:ale_enabled && g:ale_lint_on_enter && has_key(b:, 'ale_file_changed') + call remove(b:, 'ale_file_changed') + call ale#Queue(0, 'lint_file') + endif +endfunction + +function! ale#events#EnterEvent() abort + call s:LintOnEnter() +endfunction + +function! ale#events#FileChangedEvent(buffer) abort + call setbufvar(a:buffer, 'ale_file_changed', 1) + + if bufnr('') == a:buffer + call s:LintOnEnter() + endif +endfunction |