diff options
author | w0rp <devw0rp@gmail.com> | 2017-08-14 23:31:46 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-08-14 23:31:54 +0100 |
commit | 5af82312fbdec54af41fb60daae6aa59b3ee7379 (patch) | |
tree | 00b3cb21e54a3ebf206f7184b72d72f815c74b77 /autoload | |
parent | 1680f7af630da107bd0124adb434e27eef3e2371 (diff) | |
download | ale-5af82312fbdec54af41fb60daae6aa59b3ee7379.zip |
Set up one BufEnter event used for everything, and add tests for linting when the filetype changes
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/events.vim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/autoload/ale/events.vim b/autoload/ale/events.vim index 3cfe5478..a3b74677 100644 --- a/autoload/ale/events.vim +++ b/autoload/ale/events.vim @@ -24,9 +24,20 @@ function! s:LintOnEnter(buffer) abort endfunction function! ale#events#EnterEvent(buffer) abort + let l:filetype = getbufvar(a:buffer, '&filetype') + call setbufvar(a:buffer, 'ale_original_filetype', l:filetype) + call s:LintOnEnter(a:buffer) endfunction +function! ale#events#FileTypeEvent(buffer, new_filetype) abort + let l:filetype = getbufvar(a:buffer, 'ale_original_filetype', '') + + if a:new_filetype isnot# l:filetype + call ale#Queue(300, 'lint_file', a:buffer) + endif +endfunction + function! ale#events#FileChangedEvent(buffer) abort call setbufvar(a:buffer, 'ale_file_changed', 1) |