I want to set up python linting in Vim using the ALE Vim-package. So far it works well in Atom using the Atom-Plugin, but in Vim it somehow is not working. I installed
In my .vimrc I set the
let g:ale_linters={
'python': ['pylint'],
.....+other languages....
}
option. Additionally I read the ALE docs and also tried setting the following:
let g:ale_python_executable='python3'
let g:ale_python_pylint_use_global=1
ALE gets installed correctly and works for Javascript, but for Python, there is just nothing happening. In case of incorrect code (missing ")") like:
print("Hi"
nothing is marked as error.
It would be great if someone knows how to set this up and can provide some help! Thanks.
I was able to get this working, with the following steps:
install pylint
python3 -m pip install pylint
At least for my setup there was a warning:
Installing collected packages: pylint
WARNING: The scripts epylint, pylint, pyreverse and symilar are installed in '/home/vagrant/.local/bin' which is not on PATH.
so then:
Add pylint
to $PATH
export PATH="$HOME/.local/bin:$PATH"
(this can be added to ~/.profile to be configured persistently)
At you should be able to run pylint
manually:
$ cat syntaxerr.py print("hi $ pylint syntaxerr.py ************* Module syntaxerr syntaxerr.py:1:10: E0001: EOL while scanning string literal (, line 1) (syntax-error)
Install ALE
git clone https://github.com/dense-analysis/ale.git ~/.vim/pack/git-plugins/start/ale
At this point the syntax check is working as long as syntax is enabled:
$ cat .vimrc
syntax on
If you'd like to configure g:ale_linters
, note that you must escape the newline to create a multi-line dictionary:
let g:ale_linters={
\ 'python': ['pylint'],
\}
Finally, to see how ALE is currently configured, you can always run the following command:
:ALEInfo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With