nano syntax highlighting not working for all languages

Posted by Dejan on Ask Ubuntu See other posts from Ask Ubuntu or by Dejan
Published on 2013-07-01T22:41:30Z Indexed on 2013/07/01 23:15 UTC
Read the original article Hit count: 399

Filed under:

I have a funny situation where I am unable to add custom highlighting definitions to my nano text editor.

The funny thing is that the predefined work like a charm and can be edited.

But I have created a new one for js with

$ sudo touch js.nanorc
$ sudo nano js.nanorc

my current js.nanorc looks like this:

syntax "JavaScript" "\.js$"

color blue   "\<[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\>"
color blue   "\<[-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
color blue   "\<[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
color brightblue "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
color black    "[(]"
color cyan  "\<(break|case|catch|continue|default|delete|do|else|finally)\>"
color cyan  "\<(for|function|get|if|in|instanceof|new|return|set|switch)\>"
color cyan  "\<(switch|this|throw|try|typeof|var|void|while|with)\>"
color cyan  "\<(null|undefined|NaN)\>"
color brightcyan "\<(true|false)\>"
color green     "\<(Array|Boolean|Date|Enumerator|Error|Function|Math)\>"
color green     "\<(Number|Object|RegExp|String)\>"
color red "[-+/*=<>!~%?:&|]"
color magenta   "/[^*]([^/]|(\\/))*[^\\]/[gim]*"
color yellow ""(\\.|[^"])*"|'(\\.|[^'])*'"
color magenta   "\\[0-7][0-7]?[0-7]?|\\x[0-9a-fA-F]+|\\[bfnrt'"\?\\]"
color brightblack "(^|[[:space:]])//.*"
color brightblack start="/\*" end="\*/"
color brightwhite,cyan "TODO:?"
color ,green "[[:space:]]+$"
color ,red "    +"

If anyone can see the problem then please tel me

© Ask Ubuntu or respective owner

Related posts about nano