nano php highlighting

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


set nowrap
set smooth
set autoindent
set tabstospaces
set tabsize 4
include "/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"

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.