Ubuntu – How to enable syntax highlighting in a Python file without an extension

nanopython

Turning on syntax highlighting in Nano is simple enough but I've just run into a non-standard issue. I have an executable Python script that doesn't have an extension.

It's part of a virtualenv environment so here's how it starts:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

Best Answer

You can select a specific syntax highlighting using the --syntax option, for example

nano --syntax=python myscript
Related Question