Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autoload/ale.vim
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function! ale#ShouldDoNothing(buffer) abort
endif

" Do nothing for diff buffers.
if getbufvar(a:buffer, '&diff')
if getbufvar(a:buffer, '&diff') && !get(g:, 'ale_lint_diff', 0)
return 1
endif

Expand Down
11 changes: 11 additions & 0 deletions doc/ale.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1620,10 +1620,21 @@ g:ale_lint_delay
A buffer-local option, `b:ale_lint_delay`, can be set to change the delay
for different buffers, such as in |ftplugin| files.

*ale-options.ale_lint_diff*
*g:ale_lint_diff*
g:ale_lint_diff

Type: |Number|
Default: `0`

When this option is set to `1`, ALE will lint buffers where `&diff` is set.


*ale-options.lint_on_enter*
*g:ale_lint_on_enter*
lint_on_enter
g:ale_lint_on_enter

Type: |Number|
Default: `1`

Expand Down
7 changes: 7 additions & 0 deletions test/test_should_do_nothing_conditions.vader
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ After:
let b:funky_command_created = 0
endif

unlet! g:ale_lint_diff
unlet! b:funky_command_created
unlet! b:fake_mode

Expand Down Expand Up @@ -79,6 +80,12 @@ Execute(DoNothing should return 1 for diff buffers):

AssertEqual 1, ale#ShouldDoNothing(bufnr(''))

Execute(DoNothing should return 0 for diff buffers when ale_lint_diff is set):
let &diff = 1
let g:ale_lint_diff = 1

AssertEqual 0, ale#ShouldDoNothing(bufnr(''))

Execute(The DoNothing check should work if the ALE globals aren't defined):
unlet! g:ale_filetype_blacklist
unlet! g:ale_maximum_file_size
Expand Down