Highlights Python code in nano (editor in terminal)

Many of us who use text managers like Gedit, KateIncluding Notepad + + In Windows, we realize the convenience they provide when writing code.

We write code and it points / highlights the special words, own words of that code (in bash highlights cp, sudo, etc), the problem is that many times we are so deep in the terminal that it is difficult for us to get out of it (minimize it) and open a graphical text editor and be able to enjoy these benefits.

The point is that I will show you how you can make dwarf (that handy and cool in-terminal text editor) highlight words / code to them Python.

Explained graphically, here are two images, the first is WITHOUT doing anything, and the other is how files will be shown py after following this tutorial:


Cool right? LOL

Achieving this is quite, quite simple:

1. Open a terminal and put the following in it and press [enter]:

cp /usr/share/nano/python.nanorc $HOME/.nanorc

2. ….. ALREADY!!! Ready, nothing more 😉

Close that terminal and open another one, in it put:

nano test.py

And write what you want, put something in python like «print""import""from»And they will see how these words change and are highlighted.


The content of the article adheres to our principles of editorial ethics. To report an error click here.

4 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   They are Link said

    Thanks for sharing, it comes in handy if I need to edit something quickly without opening Geany

    1.    KZKG ^ Gaara <"Linux said

      Not at all, a taste that you find useful 🙂

  2.   static said

    It works in Arhlinux, I haven't tried it yet

    1.    static said

      It works perfectly Thanks, maybe you know something to recognize the indentation inside nano ???