Categories
sideprojects

nano php highlighting

My personal php.nanorc syntax highlighting settings for future reference.

/etc/nanorc

set nowrap
set smooth
set autoindent
set tabstospaces
set tabsize 4
include "/usr/share/nano/php.nanorc"

/usr/share/nano/php.nanorc

syntax "php" "\.php[45s~]?$"
# quoted text
color blue "('[^']*')|(\"[^"]*\")"
# php tags 
color brightblue "(<\?(php)?|\?>)"
# functions
color white "\<[a-z_]*\("
# types
color brightgreen "(var|float|global|double|bool|char|int|enum|const) "
# bad bad dirty dirty
color brightred "(global)"
# structure
color brightmagenta "namespace"
color brightyellow "(abstract|interface|extends|implements|class|new|private|public|protected|function) "
color yellow "( for|foreach| if|while|do| else| elseif|case|default|switch|instanceof|throw|catch)"
# control flow
color magenta "(exit;|goto|continue;|break|return)"
# comments
color white "//.*"
color brightwhite start="/\*" end="\*/"
color green "null"