3

I'm trying to set up pylint to work with :make command in Vim 8.2.

I've set :compiler pylint but running :make gives me pylint's help message, so some arguments seem to be passed incorrectly.

:set makeprg? is

makeprg=pylint --output-format=text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" --reports=no

I've tried to run this command directly in the terminal (appending the filename) and it worked -- output was the list of errors, not help message.

Unfortunately, I don't see which exact command vim is trying to execute. Any hints on what I did wrong or how to debug it?

I'd like to stick to vim's default functionality as much as possible and not use any plugins for this.

3
  • 2
    Welcome to Vi and Vim! Note that :make takes arguments; perhaps you need to run :make %? For debugging, either see :help :debug or :help 'verbose'
    – D. Ben Knoble
    Aug 25 '20 at 19:46
  • @D.BenKnoble ah yes, you're right! Somehow I was sure it's appended automatically
    – xaxa
    Aug 25 '20 at 20:14
  • 2
    Np; if that solved your problem, feel free to self-answer! That's encouraged when you have a solution (and I certainly don't need the rep)
    – D. Ben Knoble
    Aug 25 '20 at 20:26
3

how to debug it?

You can use the :verbose command to increase verbosity of a specific command.

In this particular case, you need verbosity level above 3 to see the actual shell command executed by Vim, so this should work:

:4verbose make
Calling shell to execute: "pylint --output-format=text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" --reports=no  2>&1| tee /tmp/abcde12/3"

Any hints on what I did wrong?

As @D. Ben Knoble pointed out, you're missing the name of the current file in the execution of the command. You can either fix it by passing it to the :make command, with :make %, or you can actually incorporate the % into makeprg itself, since it will expand % before running the command:

:let &makeprg = 'pylint --output-format=text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" --reports=no %'

Note the % at the end of the command-line. If you incorporate % into makeprg, then simply running :make will work to run pylint on your current file.

1
  • 1
    Great answer, thanks!
    – xaxa
    Aug 26 '20 at 20:14
2

(Thanks to @d-ben-knoble)

makeprg does not include filename, so

:make %

should be used to lint the current file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.