diff options
author | w0rp <devw0rp@gmail.com> | 2017-10-30 22:19:57 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-10-30 22:19:57 +0000 |
commit | 50f7ad35529e0672e4161e3c74be5cb87196a2f1 (patch) | |
tree | 3feeaa166f4a52a5cb4962cb890622168ba50547 /autoload | |
parent | 1575b3d7ddc5c2844d987f2abb0a5defe493972b (diff) | |
download | ale-50f7ad35529e0672e4161e3c74be5cb87196a2f1.zip |
#857 - Add b:ale_fix_on_save for controlling fixing on save for specific buffers
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/events.vim | 10 | ||||
-rw-r--r-- | autoload/ale/toggle.vim | 8 |
2 files changed, 7 insertions, 11 deletions
diff --git a/autoload/ale/events.vim b/autoload/ale/events.vim index a7f6b378..c7d17ea5 100644 --- a/autoload/ale/events.vim +++ b/autoload/ale/events.vim @@ -12,11 +12,13 @@ function! ale#events#QuitRecently(buffer) abort endfunction function! ale#events#SaveEvent(buffer) abort - call setbufvar(a:buffer, 'ale_save_event_fired', 1) - let l:should_lint = ale#Var(a:buffer, 'enabled') - \ && g:ale_lint_on_save + let l:should_lint = ale#Var(a:buffer, 'enabled') && g:ale_lint_on_save - if g:ale_fix_on_save + if l:should_lint + call setbufvar(a:buffer, 'ale_save_event_fired', 1) + endif + + if ale#Var(a:buffer, 'fix_on_save') let l:will_fix = ale#fix#Fix('save_file') let l:should_lint = l:should_lint && !l:will_fix endif diff --git a/autoload/ale/toggle.vim b/autoload/ale/toggle.vim index e8cb83a5..6809edd1 100644 --- a/autoload/ale/toggle.vim +++ b/autoload/ale/toggle.vim @@ -49,9 +49,7 @@ function! ale#toggle#InitAuGroups() abort augroup ALERunOnSaveGroup autocmd! - if (g:ale_enabled && g:ale_lint_on_save) || g:ale_fix_on_save - autocmd BufWritePost * call ale#events#SaveEvent(str2nr(expand('<abuf>'))) - endif + autocmd BufWritePost * call ale#events#SaveEvent(str2nr(expand('<abuf>'))) augroup END augroup ALERunOnInsertLeave @@ -73,10 +71,6 @@ function! ale#toggle#InitAuGroups() abort augroup END if !g:ale_enabled - if !g:ale_fix_on_save - augroup! ALERunOnSaveGroup - endif - augroup! ALEPatternOptionsGroup augroup! ALERunOnTextChangedGroup augroup! ALERunOnEnterGroup |