Vimjas / vim-python-pep8-indent

A nicer Python indentation style for vim.
Creative Commons Zero v1.0 Universal
786 stars 69 forks source link

Problem with list of strings and long strings #134

Open FantasticMrFux opened 4 years ago

FantasticMrFux commented 4 years ago

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?

david-drinn commented 2 months ago

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

david-drinn commented 2 months ago

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.