summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
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