summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2016-10-04 21:31:47 +0100
committerw0rp <devw0rp@gmail.com>2016-10-04 21:31:47 +0100
commita95aa97780ad4df7b57c6a95cb904a434841a6bc (patch)
tree702d170c949e62ad285598a3cc418c45fa415e73
parentaebf8e01963ce86040aa3571a4b2f5cab3516eb2 (diff)
downloadale-a95aa97780ad4df7b57c6a95cb904a434841a6bc.zip
Add support for linting when a file is saved.
-rw-r--r--plugin/ale/aaflags.vim3
-rw-r--r--plugin/ale/zmain.vim7
2 files changed, 10 insertions, 0 deletions
diff --git a/plugin/ale/aaflags.vim b/plugin/ale/aaflags.vim
index 467e3b6a..75accc9e 100644
--- a/plugin/ale/aaflags.vim
+++ b/plugin/ale/aaflags.vim
@@ -20,6 +20,9 @@ let g:ale_lint_delay = get(g:, 'ale_lint_delay', 100)
" This flag can be set to 0 to disable linting when the buffer is entered.
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', 0)
+
" This flag can be set to 0 to disable setting the loclist.
let g:ale_set_loclist = get(g:, 'ale_set_loclist', 1)
diff --git a/plugin/ale/zmain.vim b/plugin/ale/zmain.vim
index d73bcbee..00a6648a 100644
--- a/plugin/ale/zmain.vim
+++ b/plugin/ale/zmain.vim
@@ -354,6 +354,13 @@ if g:ale_lint_on_enter
augroup END
endif
+if g:ale_lint_on_save
+ augroup ALERunOnSaveGroup
+ autocmd!
+ autocmd BufWrite * call ALELint(0)
+ augroup END
+endif
+
" Clean up buffers automatically when they are unloaded.
augroup ALEBuffferCleanup
autocmd!