If not already presetn, copy /usr/doc/nano-<version>/nanorc.sample to /etc/nanorc. Then, and at the end of the file, uncomment the include files for the languages which you want to be syntax highlighted. E.g.:
include "/usr/share/nano/c.nanorc"
Nano (2.0.9 and older) doesn't ship wiht a syntax highlighting file for PHP by default. So copy the following to /usr/local/share/nano/php.nanorc:
syntax "php" "\.php[2345s~]?$"
color brightblue "(.*)\("
color cyan "\$[a-zA-Z_0-9$]*|[=!<>]"
color green "(var|class|function|echo|case|break|default|exit|switch|if|else|elseif|@|while)\s"
color green "[.,{}();]"
color red "('[^']*')|(\"[^"]*\")"
color brightyellow "(#.*|//.*)$"
color brightyellow start="/\*" end="\*/"
color brightblue "(<\?(php)?|\?>)"
color white start="\?>" end="<\?(php)?"
(This is a slightly modified version of the original from linuxhelp.net)
Now include the file in /etc/nanorc by adding this line:
include "/usr/local/share/nano/php.nanorc"
…seems missing in versions prior to 2.1
| Meta-W | Repaeat lasst search |
| Meta-L | Toggle Long Line Wrapping |
| Meta-C | Always show cursor position on/off |