How to prevent PyCharm from reformatting my code

I am trying to follow PEP8 which suggests spaces around operators should follow precedence. Therefore I do not want PyCharm to reformat them. I have:
Editor -> General -> Smart Keys -> Reformat on paste = None

Editor -> Code Style -> Python -> Spaces -> Additive operators = False

Editor -> Code Style -> Python -> Spaces -> Multiplicative operators = False

but still when i paste, PyCharm will remove spaces.
E.g. "2*2 + 4" will be formatted to "2*2+4"
or "(2+2) * 4" will be formatted to "(2+2)*4"

How can I force PyCharm to respect my mixed style and not change spacing at all around operators?
Is my best option to map Ctrl-V to "paste as plain"?

1 comment
Comment actions Permalink

What version of PyCharm, and did you try to copy from different sources just for testing? My PyCharm has all the settings pretty much at default and doesn't happen to me.


Please sign in to leave a comment.