0

I am trying to set up my pylintrc file in vim, but am having some difficulty getting it to read from the correct path. It seems to work when I have the file in the directory that contains the vim file I am editing, but if I put it into my vim directory, which is:

~/.vim/.pylintrc

It doesn't recognize it. How do I tell vim to read the pylintrc file from that directory? The only settings I have related to it are:

Plug 'dense-analysis/ale'
let b:ale_linters = ['pylint', 'mypy']

Note: my settings currently work (when the file is in the main directory). However, I am wondering how I can change from where it reads the settings/path.

[Cross-posted from SO (no answers)]

3

1 Answer 1

2

Knowing from :help ale-python-pylint that we want to adjust g:ale_python_pylint_options to include --rcfile, I would drop

let g:ale_python_pylint_options = '--rcfile '.<filename>

in wherever the right place is for you. That could be wherever you configure ALE, if a single setting is right; or, it could be in an ftplugin (use b:…) if you need to change the name based on the specific file/project/whatever.

For the specific ~/.vim/.pylintrc, you should be able to do

let g:ale_python_pylint_options = '--rcfile '.expand('~/.vim/.pylintrc')

It's possible expand() isn't necessary if pylint will properly tilde-expand its arguments, but I haven't tested that (a smoke-test would be to run something like sh -c 'pylint --rcfile '\''~/.vim/.pylintrc'\'' <other options>' and see if it picks up your settings; run it in your own shell if single-quotes disable all expansion: pylint --rcfile '~/.vim/pylintrc' <other options>).

3
  • ben -- awesome, thank you that works!
    – David542
    Commented Apr 7, 2021 at 17:52
  • Ben -- have you ever used Jedi before: vi.stackexchange.com/questions/30871/… ?
    – David542
    Commented Apr 7, 2021 at 17:52
  • 1
    @David542 IIRC I tried it once and scrapped it, a bit too invasive in my opinion. Looks like you're having similar experiences. I can only recommend checking the docs (e.g., :help jedi) and the code to see if there are knobs you can pull to disable things. Otherwise you might be able to rip out the necessary code to just support keywordprg
    – D. Ben Knoble
    Commented Apr 7, 2021 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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