Skip to content

Instantly share code, notes, and snippets.

@k1r0s
Last active February 27, 2021 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k1r0s/f5ef708dd70d053453412ee3e59c8c48 to your computer and use it in GitHub Desktop.
Save k1r0s/f5ef708dd70d053453412ee3e59c8c48 to your computer and use it in GitHub Desktop.
nano editor syntax highlight
## https://nano-editor.org/dist/v2.2/nano.html#Nanorc-Files
syntax "javascript" "\.(js|jsx)$"
## Default
color white "^.+$"
## Decimal, cotal and hexadecimal numbers
color brightblue "\<[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\>"
## Floating point number with at least one digit before decimal point
color brightblue "\<[-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
color brightblue "\<[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
## Boolean
color brightblue "\<(true|false)\>"
## Special types
color red "\<(null|undefined|NaN)\>"
## Function call
color brightwhite "\w+\(" "\(" "\)"
## Keywords
color green "\<(abstract|await|boolean|break|byte|case|catch|char)\>"
color green "\<(class|const|continue|debugger|default|delete|double)\>"
color green "\<(do|else|enum|export|extends|finally|final|float|for)\>"
color green "\<(from|function|goto|if|implements|import|instanceof)\>"
color green "\<(interface|int|in|let|long|native|new|package|private)\>"
color green "\<(protected|public|return|short|static|super|switch)\>"
color green "\<(synchronized|self|this|throw|transient|try|typeof)\>"
color green "\<(var|void|volatile|while|with|yield|async)\>"
color green "\=>"
## Type specifiers
color yellow "\b[A-Z]\w+"
color brightyellow "\<(Array|Boolean|Date|Enumerator|Function|Math|BigInt)\>"
color brightyellow "\<(Number|Object|RegExp|String|Promise|Infinity)\>"
color brightyellow "\<(Map|Set|JSON|ArrayBuffer)\>"
## Decorators
color brightblue "@\w+"
## Errors
color brightred "(Error|AggregateError|EvalError|InternalError|RangeError)"
color brightred "(ReferenceError|SyntaxError|TypeError|URIError)"
color brightred "\b\w+Error\b"
## Constants
color brightmagenta "\b[A-Z_]+\b"
## String
color brightblack "L?\"(\\"|[^"])*\""
color brightblack "L?'(\'|[^'])*'"
color brightblack "L?`(\`|[^`])*`"
color brightblack start="`" end="`"
color brightcyan,blue start="\$\{" end="\}"
## Comments
color white,blue start="/\*" end="\*/"
color white,blue "//.*$"
## Comment keywords
color brightwhite,blue "(@author|@version|@since|@see|@param|@return|@exception)"
color brightwhite,blue "(@throws|@deprecated|@link|@value|@type|@code|@literal)"
color brightwhite,blue "(@serial|@data|@field|@required|@default)"
## Escapes
color magenta "\\[0-7][0-7]?[0-7]?|\\x[0-9a-fA-F]+|\\[bfnrt'"\?\\]"
## Trailing whitespace
color ,red "[[:space:]]+$"
## Semicolon highlight
color brightgreen "\;$"
@k1r0s
Copy link
Author

k1r0s commented Feb 26, 2021

jsx hightlight will be added soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment