summaryrefslogtreecommitdiff
path: root/autoload/ale/events.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-06-24 12:24:31 +0100
committerw0rp <devw0rp@gmail.com>2017-06-24 12:24:31 +0100
commit1ea61162a0c43da9a149b24dc35911cb981fbe7c (patch)
treea88621586401f17299cd85835f47a8a27d224296 /autoload/ale/events.vim
parentfbf8ccb882eb7819011fa837ea2b4930ed4fa9c7 (diff)
downloadale-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.vim19
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