Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop pycharm auto format code after pasted?

In brief

I want to turn off code auto-formation in PyCharm

In full

I often get my comments auto-formatted

from

#my comment

to

# my comment with space inserted

I want to turn this off and found via google this article from JetBrains; though I cannot find the guided option in my PyCharm as snapshots below.

I'm using

PyCharm 2016.2.3
Build #PY-162.1967.10, built on September 7, 2016

enter image description here

like image 830
Nam G VU Avatar asked Nov 16 '16 03:11

Nam G VU


1 Answers

look under Preferences -> Editor -> General -> Smart Keys -> Reformat On Paste and set to 'None'. see screen.

enter image description here

UPDATE: looks like the suggestion above didn't work, but i did find another editor setting (python-specific) that will auto-format your code. see attached screenshot. you can get to the setting via:

Preferences->Editor->Code Style->Python near the bottom. deselect the after # setting and try again. this worked for me -- it allowed me to paste the string you had above without having it auto-formatted. HTH

enter image description here

like image 105
matias elgart Avatar answered Nov 19 '22 23:11

matias elgart