0

I have some autogenerated python files that are extremely large (long mathematical equations). Vim slows to a crawl when I open them for editing because I have pyflakes-vim installed. I'd like to be able to disable pyflakes-vim only when I open these long files. Is there a simple way to do this, either before opening the file or even after? I do not want to turn off pyflakes-vim for all python files, just a case-by-case basis.

moorepants
  • 1,813
  • 2
  • 22
  • 23

3 Answers3

4

PyFlakes won't run if b:did_pyflakes_plugin is defined when the plugin is loaded, but once it's loaded I don't think there's an easy way to disable it.

What I would do is give the auto-generated files a specific file name pattern (say *_auto.py) and then add to my .vimrc: autocmd BufReadPre *_auto.py :let b:did_pyflakes_plugin=1.

Itay Perl
  • 12,844
  • 3
  • 18
  • 12
1

Take a look at flake8 - either as part of Syntastic or just vim-flake8 - then you can add # noqa at the end of a line to disable checking for that line. Also see this related question.

Community
  • 1
  • 1
Pierz
  • 7,064
  • 52
  • 59
  • Worked for me! Note: there must be a separation of 2 spaces between the last character in the code and the '#'. – GH05T Apr 02 '17 at 18:02
1

I've found another solution which is handy: https://github.com/kevinw/pyflakes-vim/pull/47

This fork of pyflakes-vim, which has not been merged in yet, allows you to toggle pyflakes on or off.

moorepants
  • 1,813
  • 2
  • 22
  • 23
  • It looks like pyflakes-vim is no longer been maintained. I've emailed the author, send a pull request, created an issue in the bug tracker but never got a response. Would you be interested in getting your changes merged properly in a newly maintained pyflakes-vim fork? – alfredodeza Dec 01 '11 at 14:31