summaryrefslogtreecommitdiff
path: root/plugin/ale.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-04-26 23:02:00 +0100
committerw0rp <devw0rp@gmail.com>2017-04-26 23:02:00 +0100
commitce2f777e33f25c01830a0e62cc3ae23a8ba80953 (patch)
treeeacaf3fdab01de1bf3c82841fc4265abb717a051 /plugin/ale.vim
parent65fc4aeb1e12d75b2174bdcd887aacf2c7c98952 (diff)
downloadale-ce2f777e33f25c01830a0e62cc3ae23a8ba80953.zip
Fix #505 Stop g:ale_lint_on_filetype_changed linting when you open buffers
Diffstat (limited to 'plugin/ale.vim')
-rw-r--r--plugin/ale.vim10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugin/ale.vim b/plugin/ale.vim
index b6f6f296..0e8c369f 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -181,7 +181,15 @@ function! ALEInitAuGroups() abort
augroup ALERunOnFiletypeChangeGroup
autocmd!
if g:ale_enabled && g:ale_lint_on_filetype_changed
- autocmd FileType * call ale#Queue(300, 'lint_file')
+ " 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 !=# expand('<amatch>')
+ \| call ale#Queue(300, 'lint_file')
+ \| endif
endif
augroup END