vim-python-pep8-indent icon indicating copy to clipboard operation
vim-python-pep8-indent copied to clipboard

Problem with list of strings and long strings

Open FantasticMrFux opened this issue 5 years ago • 2 comments

Maybe my problem hast to do with my lack of understanding of the pep8 standards. So if I have a list of strings like this:

list_of_strings = ["Affy ID", "Agilent ID", "Allergome Code", "longerrrrrrrrrr ID", "ID", "WormPep Protein ID", "XenBase Gene ID", "ZFIN ID"]

when i gq I get the following result

list_of_strings = ["Affy ID", "Agilent ID", "Allergome Code", "longerrrrrrrrrr
                   ID", "ID", "WormPep Protein ID", "XenBase Gene ID", "ZFIN
                   ID"]

Which breaks my code

  File "./t.py", line 3
    list_of_strings = ["Affy ID", "Agilent ID", "Allergome Code", "longerrrrrrrrrr
                                                                                 ^
SyntaxError: EOL while scanning string literal

And under my understanding it should indent the line like so:

list_of_strings = ["Affy ID", "Agilent ID", "Allergome Code",
                   "longerrrrrrrrrr ID", "ID", "WormPep Protein ID",
                   "XenBase Gene ID", "ZFIN ID"]

Second assuming I have this string:

string = "Affy ID Agilent ID Allergome Code longerrrrrrrrrr ID ID WormPep Protein ID XenBase Gene ID ZFIN ID"

results in

string = "Affy ID Agilent ID Allergome Code longerrrrrrrrrr ID ID WormPep
Protein ID XenBase Gene ID ZFIN ID"

I would assume that it should like so:

string = ("Affy ID Agilent ID Allergome Code longerrrrrrrrrr ID ID WormPep"
          "Protein ID XenBase Gene ID ZFIN ID")

So what do I not understand? Is there an option to stop vim-python-pep8-indent from wrapping in between strings?

FantasticMrFux avatar Feb 20 '20 18:02 FantasticMrFux

Yes, well identified with good examples. I have the same problem, and it basically makes this plugin unusable as-is.

david-drinn avatar Jul 09 '24 21:07 david-drinn

I worked around this in my case, by essentially no longer using the textwidth option. I was setting it to 79 in my personal config. The bundle I'm using sets the default to 500. This means it effectively never triggers, since I almost never have lines that long.

david-drinn avatar Jul 09 '24 21:07 david-drinn