So I have googled, I have SO'd, I have tried...
How can I get PyCharm to do PEP8 auto format as an on save action?
I found that I can do Ctrl+Alt+L to do auto formatting. I got used to having that as on save action on eclipse, so I'd like that in PyCharm. It was easy to do in GoGland, so why not in PyCharm?
I'm lost, please help...
So what worked for me was roundabout but I haven't found an easy built in option to do this. My solution was to record a macro of format and save and then reassign the ctrl+s keybinding to that macro.
To make the macro: - Edit>Macros>Start Recording - Run ctrl+alt+L and then ctrl+s - Edit>Macros>Stop Recording>call it something like save and format
To reassign ctrl+s: - Settings>Keymap>Macros: - Select your macro and 'Add Keyboard Shortcut' and enter ctrl+s - Opt to remove it from save since your macro does that anyway
Documentation that goes into more detail: https://www.jetbrains.com/help/pycharm/recording-macros.html https://www.jetbrains.com/help/pycharm/binding-macros-with-keyboard-shortcuts.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With