How to Enable Auto-Indent for Python Code in Notepad++

Notepad++ is a free application and unlike our regular Windows Notepad, this one is specially designed for developers because of the features it offers to ease coding. If you are working on Notepad++ for writing Python code and want to format it correctly to enhance the readability and maintainability of the code, then in this article we learn how to do that.

Here, we learn how to install the Python Indent plugin in Notepad++ to enable the auto-formatting of Python code in Notepad++ easily.

To follow this tutorial you should have Notepad++ installed on your Windows. However, If you are a Linux user and don’t have it, then see our tutorial to learn how to install Notepad++ in Ubuntu Linux.

#1 Method using the Default Auto Indent

Enable In-built Auto Indent in NotePad++

NotePad++ software offers auto-indent settings that although enabled by default, if not then here are the steps to make it.

  • Open NotePad++
  • From the software menu select “Settings” and then the Preferences option.
  • From the left side menu select Auto-completion and check the box given for Auto-indent, if not already.
Enable In built Auto Indent in NotePad

#2nd Method is using the Plugin, if the Auto-indent is not working for you.

Install Python Indent Plugin

Here are the steps that you need to follow for the installation of a plugin called Python Indent.

  1. On your Windows open Notepad++ and from the menu bar select the Plugins option.
  2. From the drop-down menu select the “Plugins Admin” option.
  3. In the following windows, you will see a search box their type- “Python Indent” and you will see it in the list of available plugins.
  4. Now, check the box given for “Python Indent” and hit the Install button present on the right side top corner.
  5. Follow the wizard and finish the installation process.
Open Notepad Plugins Admin
Install Python Indent plugin

Enable Python Indent

  1. Go to “Plugins” in the menu bar
  2. Select “Python Indent” from the dropdown menu.
  3. Choose “Enable” and you are done

Select Python Language

To code in Python select it as the programming language in Notepad++. For that click on the Language menu and select the letter “P” and then Python.

Select Python language in Notepad

Installing and utilizing the Python Indent plugin in Notepad++, you can easily format your Python code to increase overall development efficiency in your Python projects using Notepad++.