summaryrefslogtreecommitdiff
path: root/autoload/ale/events.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-10-14 23:22:13 +0100
committerw0rp <devw0rp@gmail.com>2017-10-14 23:22:13 +0100
commitef495ba32db2b0c21e73e2ef0034de6888854587 (patch)
tree75b3701d9dbc4d4cdac0c991b921a0dbd776897a /autoload/ale/events.vim
parent010ebc2459d2ce72d8c264737a9faa4ac694dbe5 (diff)
downloadale-ef495ba32db2b0c21e73e2ef0034de6888854587.zip
#904 Do not run linters on :wq or :x
Diffstat (limited to 'autoload/ale/events.vim')
-rw-r--r--autoload/ale/events.vim11
1 files changed, 10 insertions, 1 deletions
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 <devw0rp@gmail.com>
+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)