1

I do most of my Python coding in Notepad++. I would like a way to quickly and easily reformat my code using the default rules from PyCharm - things like spacing, number of blank lines between functions etc.

I find black playground too harsh for my requirements, and opening up PyCharm to paste code and reformat it defeats to purpose of using Notepad++ (for it's lightness).

So do you know of either a plugin for Notepad++ which does this (and I'm not just referring to Python Indent), or an online resource which applies PyCharm style formatting to pasted code?

Robin Andrews
  • 3,514
  • 11
  • 43
  • 111

1 Answers1

2

PyCharm comes with a CLI, like documented here https://www.jetbrains.com/help/pycharm/command-line-formatter.html. Alternatively and making the call slightly shorter: parallel to the mentioned there general batch file, you probably also have 'format.bat'. You can integrate this into Notepad++ via the [F5] button "Run...": Put there

C:\__YourPyCharmRoot__\bin\format.bat "$(FULL_CURRENT_PATH)"

and press the [Save] button in this "Run..." dialog to assign a short-cut.

Pressing the newly defined short-cut on a saved and writable Python file should let Notepad++ ask you after a while (of running PyCharm in Windows cmd.exe) to reload the changed file .

thoku
  • 1,120
  • 9
  • 27