Nano php.ini syntax highlighting for nanorc

Published on Author JFLeave a comment

Here’s a style file for php.ini when using nano. For this particular situation it is Ubuntu 22.04.

sudo nano/usr/share/nano/phpini.nanorc

Copy/paste this into it:

## Syntax highlighting for PHP.ini.

syntax "ini" "\.ini(\.old|~)?$"

magic "PHP ini"
comment "//"

# Trailing whitespace.
color green "[[:space:]]+$"
# values
color brightred "=.*$"
# equal sign
color green "="
# numbers
color brightblue "-?[0-9\.]+\s*($|;)"
# ON/OFF
color brightmagenta "ON|OFF|On|Off|on|off\s*($|;)"
# sections
color brightcyan "^\s*\[.*\]"
# keys
 color cyan "^\s*[a-zA-Z0-9_\.]+"
# comments
color brightyellow ";.*$"

ctrl+X to save/exit

Adjust colors to suit your tastes.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.