From ef495ba32db2b0c21e73e2ef0034de6888854587 Mon Sep 17 00:00:00 2001 From: w0rp Date: Sat, 14 Oct 2017 23:22:13 +0100 Subject: #904 Do not run linters on :wq or :x --- autoload/ale/events.vim | 11 ++++++++++- autoload/ale/fix.vim | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'autoload') diff --git a/autoload/ale/events.vim b/autoload/ale/events.vim index efae11c1..1992b1ee 100644 --- a/autoload/ale/events.vim +++ b/autoload/ale/events.vim @@ -1,8 +1,15 @@ " Author: w0rp +function! ale#events#QuitEvent(buffer) abort + " Remember when ALE is quitting for BufWrite, etc. + call setbufvar(a:buffer, 'ale_quitting', 1) +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 + \ && !getbufvar(a:buffer, 'ale_quitting') if g:ale_fix_on_save let l:will_fix = ale#fix#Fix('save_file') @@ -24,6 +31,8 @@ function! s:LintOnEnter(buffer) abort endfunction function! ale#events#EnterEvent(buffer) abort + " When entering a buffer, we are no longer quitting it. + call setbufvar(a:buffer, 'ale_quitting', 0) let l:filetype = getbufvar(a:buffer, '&filetype') call setbufvar(a:buffer, 'ale_original_filetype', l:filetype) diff --git a/autoload/ale/fix.vim b/autoload/ale/fix.vim index e1210f17..2b5387de 100644 --- a/autoload/ale/fix.vim +++ b/autoload/ale/fix.vim @@ -56,7 +56,9 @@ function! ale#fix#ApplyQueuedFixes() abort " If ALE linting is enabled, check for problems with the file again after " fixing problems. - if g:ale_enabled && l:should_lint + if g:ale_enabled + \&& l:should_lint + \&& !getbufvar(l:buffer, 'ale_quitting') call ale#Queue(0, l:data.should_save ? 'lint_file' : '') endif endfunction -- cgit v1.2.3