summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-03-27 22:40:25 +0100
committerw0rp <devw0rp@gmail.com>2017-03-27 22:40:25 +0100
commitab3fd2e849ba74e48987fe64a622d7734dd7624c (patch)
tree1f0c4cfe4fee6dd9adc7b033955452e1d1a428b3 /plugin
parentc9ee3efc1111d0de61e22d1c4cd6c1a49d5ae74a (diff)
downloadale-ab3fd2e849ba74e48987fe64a622d7734dd7624c.zip
Fix #130 - Run linters when the filetype is changed
Diffstat (limited to 'plugin')
-rw-r--r--plugin/ale.vim10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugin/ale.vim b/plugin/ale.vim
index 2e593893..aadecb66 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -78,6 +78,9 @@ let g:ale_lint_on_enter = get(g:, 'ale_lint_on_enter', 1)
" This flag can be set to 1 to enable linting when a buffer is written.
let g:ale_lint_on_save = get(g:, 'ale_lint_on_save', 1)
+" This flag can be set to 1 to enable linting when the filetype is changed.
+let g:ale_lint_on_filetype_changed = get(g:, 'ale_lint_on_filetype_changed', 1)
+
" This flag may be set to 0 to disable ale. After ale is loaded, :ALEToggle
" should be used instead.
let g:ale_enabled = get(g:, 'ale_enabled', 1)
@@ -161,6 +164,13 @@ function! s:ALEInitAuGroups() abort
endif
augroup END
+ augroup ALERunOnFiletypeChangeGroup
+ autocmd!
+ if g:ale_enabled && g:ale_lint_on_filetype_changed
+ autocmd FileType * call ale#Queue(300, 'lint_file')
+ endif
+ augroup END
+
augroup ALERunOnSaveGroup
autocmd!
if g:ale_enabled && g:ale_lint_on_save