summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-08-14 23:31:46 +0100
committerw0rp <devw0rp@gmail.com>2017-08-14 23:31:54 +0100
commit5af82312fbdec54af41fb60daae6aa59b3ee7379 (patch)
tree00b3cb21e54a3ebf206f7184b72d72f815c74b77 /plugin
parent1680f7af630da107bd0124adb434e27eef3e2371 (diff)
downloadale-5af82312fbdec54af41fb60daae6aa59b3ee7379.zip
Set up one BufEnter event used for everything, and add tests for linting when the filetype changes
Diffstat (limited to 'plugin')
-rw-r--r--plugin/ale.vim17
1 files changed, 8 insertions, 9 deletions
diff --git a/plugin/ale.vim b/plugin/ale.vim
index e2180129..584295c5 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -218,27 +218,26 @@ function! ALEInitAuGroups() abort
augroup ALERunOnEnterGroup
autocmd!
+ if g:ale_enabled
+ " Handle everything that needs to happen when buffers are entered.
+ autocmd BufEnter * call ale#events#EnterEvent(str2nr(expand('<abuf>')))
+ endif
if g:ale_enabled && g:ale_lint_on_enter
autocmd BufWinEnter,BufRead * call ale#Queue(0, 'lint_file', str2nr(expand('<abuf>')))
" Track when the file is changed outside of Vim.
autocmd FileChangedShellPost * call ale#events#FileChangedEvent(str2nr(expand('<abuf>')))
- " If the file has been changed, then check it again on enter.
- autocmd BufEnter * call ale#events#EnterEvent(str2nr(expand('<abuf>')))
endif
augroup END
augroup ALERunOnFiletypeChangeGroup
autocmd!
if g:ale_enabled && g:ale_lint_on_filetype_changed
- " Set the filetype after a buffer is opened or read.
- autocmd BufEnter,BufRead * let b:ale_original_filetype = &filetype
" Only start linting if the FileType actually changes after
" opening a buffer. The FileType will fire when buffers are opened.
- autocmd FileType *
- \ if has_key(b:, 'ale_original_filetype')
- \ && b:ale_original_filetype isnot# expand('<amatch>')
- \| call ale#Queue(300, 'lint_file')
- \| endif
+ autocmd FileType * call ale#events#FileTypeEvent(
+ \ str2nr(expand('<abuf>')),
+ \ expand('<amatch>')
+ \)
endif
augroup END