The text editor nano manages syntax highlighting through .nanorc files. Say, we have files with the ending .phpx, but would like PHP syntax highlighting.
$ sudo nano /usr/share/nano/php.nanorc
Change this line
syntax "php" "\.php[2345s~]?$"
to this regex:
syntax "php" "\.php[x2345s~]?$"
.
Alternativly, e.g. if you don’t have sudo rights for /usr/share/nano/php.nanorc, you can do the following
$cp /usr/share/nano/php.nanorc ~/.phpx.nanorc
Then enter the following line in ~/.nanorc:
include ~/.phpx.nanorc
Then, change the line as mentioned above and syntax „php“ into syntax „phpx“