summaryrefslogtreecommitdiff
path: root/plugin/ale.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-05-30 21:32:51 +0100
committerw0rp <devw0rp@gmail.com>2017-05-30 21:32:51 +0100
commit6ec965c8e4618c14b05b05bd554b3fed9c1191e1 (patch)
tree1c2dcf20cbb3ee0d5c538b6d0760e5f0ea2fd755 /plugin/ale.vim
parentbc317a7be5e5c9db85b59c6377f3a9b9f034535c (diff)
downloadale-6ec965c8e4618c14b05b05bd554b3fed9c1191e1.zip
#591 Support fixing files on save
Diffstat (limited to 'plugin/ale.vim')
-rw-r--r--plugin/ale.vim11
1 files changed, 8 insertions, 3 deletions
diff --git a/plugin/ale.vim b/plugin/ale.vim
index b5991549..1f9df896 100644
--- a/plugin/ale.vim
+++ b/plugin/ale.vim
@@ -89,6 +89,8 @@ 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)
+call ale#Set('fix_on_save', 0)
+
" 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)
@@ -218,8 +220,8 @@ function! ALEInitAuGroups() abort
augroup ALERunOnSaveGroup
autocmd!
- if g:ale_enabled && g:ale_lint_on_save
- autocmd BufWrite * call ale#Queue(0, 'lint_file')
+ if (g:ale_enabled && g:ale_lint_on_save) || g:ale_fix_on_save
+ autocmd BufWrite * call ale#events#SaveEvent()
endif
augroup END
@@ -242,10 +244,13 @@ function! ALEInitAuGroups() abort
augroup END
if !g:ale_enabled
+ if !g:ale_fix_on_save
+ augroup! ALERunOnSaveGroup
+ endif
+
augroup! ALEPatternOptionsGroup
augroup! ALERunOnTextChangedGroup
augroup! ALERunOnEnterGroup
- augroup! ALERunOnSaveGroup
augroup! ALERunOnInsertLeave
augroup! ALECursorGroup
endif