This tutorial explains How to do Python Indentation in Notepad++.

Notepad++ is a simple editor, not a full-featured IDE, It will not do auto indentation by default.

First, You need to indent the first line manually, Notepad++ auto indents subsequent lines automatically.

Multiple ways we a do auto-indentation of Python code in Notepad++

  • using plugin
  • Settings

Settings

For the new and latest version

  • Open Notepad++ Editor
  • Go to Settings Menu
  • Select Preferences Item, Popup Window opened
  • Select the Auto Completion Tab, and Check the Auto indent checkbox to do automatic indentation as per the below screenshot
  • Restart Notepad++

auto-indent-python.png

Another way, if the above option is not shown for older versions, please follow the below steps

  • Go to Settings Menu
  • Select Preferences Item, Popup Window opened
  • Select the MISC Tab, check the Auto Indent checkbox
  • Restart Notepad++

Python plugin to auto-indent

  • Select plugins Menu, Select Plugin Admin
  • Search Python and select the Python indent plugin as given below
  • Click the Install button to install the plugin

auto-indent-python.png

  • Once installed, next enable it
  • Select the Plugins Menu, Select the Python Indent item, and Check Enable option
  • Restart Notepad++