diff --git a/ale_linters/python/flake8.vim b/ale_linters/python/flake8.vim index 5986f708..9dcdacc6 100644 --- a/ale_linters/python/flake8.vim +++ b/ale_linters/python/flake8.vim @@ -12,7 +12,8 @@ function! s:UsingModule(buffer) abort endfunction function! ale_linters#python#flake8#GetExecutable(buffer) abort - if ale#Var(a:buffer, 'python_flake8_auto_pipenv') && ale#python#PipenvPresent(a:buffer) + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_flake8_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif diff --git a/ale_linters/python/mypy.vim b/ale_linters/python/mypy.vim index 953c358f..0c90a3c7 100644 --- a/ale_linters/python/mypy.vim +++ b/ale_linters/python/mypy.vim @@ -8,7 +8,8 @@ call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_mypy_auto_pipenv', 0) function! ale_linters#python#mypy#GetExecutable(buffer) abort - if ale#Var(a:buffer, 'python_mypy_auto_pipenv') && ale#python#PipenvPresent(a:buffer) + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_mypy_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif diff --git a/ale_linters/python/prospector.vim b/ale_linters/python/prospector.vim index 622d3d68..b01cec87 100644 --- a/ale_linters/python/prospector.vim +++ b/ale_linters/python/prospector.vim @@ -12,7 +12,8 @@ let g:ale_python_prospector_options = let g:ale_python_prospector_use_global = get(g:, 'ale_python_prospector_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#python#prospector#GetExecutable(buffer) abort - if ale#Var(a:buffer, 'python_prospector_auto_pipenv') && ale#python#PipenvPresent(a:buffer) + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_prospector_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif diff --git a/ale_linters/python/pycodestyle.vim b/ale_linters/python/pycodestyle.vim index 3b156d3d..f0269585 100644 --- a/ale_linters/python/pycodestyle.vim +++ b/ale_linters/python/pycodestyle.vim @@ -7,7 +7,8 @@ call ale#Set('python_pycodestyle_use_global', get(g:, 'ale_use_global_executable call ale#Set('python_pycodestyle_auto_pipenv', 0) function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort - if ale#Var(a:buffer, 'python_pycodestyle_auto_pipenv') && ale#python#PipenvPresent(a:buffer) + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycodestyle_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif diff --git a/ale_linters/python/pyflakes.vim b/ale_linters/python/pyflakes.vim index 33410562..091408d5 100644 --- a/ale_linters/python/pyflakes.vim +++ b/ale_linters/python/pyflakes.vim @@ -6,7 +6,8 @@ call ale#Set('python_pyflakes_use_global', get(g:, 'ale_use_global_executables', call ale#Set('python_pyflakes_auto_pipenv', 0) function! ale_linters#python#pyflakes#GetExecutable(buffer) abort - if ale#Var(a:buffer, 'python_pyflakes_auto_pipenv') && ale#python#PipenvPresent(a:buffer) + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflakes_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif diff --git a/ale_linters/python/pylint.vim b/ale_linters/python/pylint.vim index 196f1b35..01c3cb37 100644 --- a/ale_linters/python/pylint.vim +++ b/ale_linters/python/pylint.vim @@ -8,7 +8,8 @@ call ale#Set('python_pylint_change_directory', 1) call ale#Set('python_pylint_auto_pipenv', 0) function! ale_linters#python#pylint#GetExecutable(buffer) abort - if ale#Var(a:buffer, 'python_pylint_auto_pipenv') && ale#python#PipenvPresent(a:buffer) + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pylint_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif diff --git a/ale_linters/python/pyls.vim b/ale_linters/python/pyls.vim index 9dbb5081..83fe8066 100644 --- a/ale_linters/python/pyls.vim +++ b/ale_linters/python/pyls.vim @@ -6,7 +6,8 @@ call ale#Set('python_pyls_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pyls_auto_pipenv', 0) function! ale_linters#python#pyls#GetExecutable(buffer) abort - if ale#Var(a:buffer, 'python_pyls_auto_pipenv') && ale#python#PipenvPresent(a:buffer) + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyls_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif diff --git a/ale_linters/python/pyre.vim b/ale_linters/python/pyre.vim index 1c45536c..adc185f2 100644 --- a/ale_linters/python/pyre.vim +++ b/ale_linters/python/pyre.vim @@ -6,7 +6,8 @@ call ale#Set('python_pyre_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pyre_auto_pipenv', 0) function! ale_linters#python#pyre#GetExecutable(buffer) abort - if ale#Var(a:buffer, 'python_pyre_auto_pipenv') && ale#python#PipenvPresent(a:buffer) + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyre_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif diff --git a/autoload/ale/python.vim b/autoload/ale/python.vim index ec88a4b2..8d6bf1f0 100644 --- a/autoload/ale/python.vim +++ b/autoload/ale/python.vim @@ -1,6 +1,8 @@ " Author: w0rp " Description: Functions for integrating with Python linters. +call ale#Set('python_auto_pipenv', '0') + let s:sep = has('win32') ? '\' : '/' " bin is used for Unix virtualenv directories, and Scripts is for Windows. let s:bin_dir = has('unix') ? 'bin' : 'Scripts' diff --git a/doc/ale-python.txt b/doc/ale-python.txt index 9edb2996..0b8e1746 100644 --- a/doc/ale-python.txt +++ b/doc/ale-python.txt @@ -2,6 +2,14 @@ ALE Python Integration *ale-python-options* +g:ale_python_auto_pipenv *g:ale_python_auto_pipenv* + *b:ale_python_auto_pipenv* + Type: |Number| + Default: `0` + + Detect whether the file is inside a pipenv, and set the executable to `pipenv` + if true. This is overridden by a manually-set executable. + =============================================================================== ALE Python Project Root Behavior *ale-python-root*