>From 55e5330f8a03f1dbba6d633c108282a2e45b38c5 Mon Sep 17 00:00:00 2001 From: Brand Huntsman
Date: Fri, 19 Jan 2018 03:58:55 -0700 Subject: [PATCH 4/4] prevent end-of-line comments from highlighting strings and #RGB colors Signed-off-by: Brand Huntsman --- syntax/nanorc.nanorc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc index 73bf9f45..a6a6be1e 100644 --- a/syntax/nanorc.nanorc +++ b/syntax/nanorc.nanorc @@ -6,6 +6,11 @@ comment "#" # Possible errors and parameters icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|linter|formatter|i?color|extendsyntax).*$" +# EOL Comments +# - any errors before the # will be brightblue instead of brightred +# - must be here to prevent end-of-line comments from highlighting #rgb colors and strings containing "[[:space:]]#" +color brightblue "^[[:space:]]*(set|unset|bind|unbind).*[[:space:]]+#.*$" + # Keywords icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|atblanks|autoindent|backup|backwards|boldtext|casesensitive|constantshow|cutfromcursor|fill[[:space:]]+-?[[:digit:]]+|historylog|linenumbers|locking|morespace|mouse|multibuffer|noconvert|nohelp|nopauses|nonewlines|nowrap|positionlog|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|showcursor|smarthome|smooth|softwrap|suspend|tabsize[[:space:]]+[1-9][0-9]*|tabstospaces|tempfile|trimblanks|unix|view|wordbounds)\>" icolor yellow "^[[:space:]]*set[[:space:]]+((function|key|number|selected|status|title)color)[[:space:]]+((bold|italic|reverse|underline)(,(bold|italic|reverse|underline))*|((bold|italic|reverse|underline),)*((bright)?(white|black|red|blue|green|yellow|magenta|cyan)|([0-9]+|#[0-9A-Fa-f]{6}|#[0-9A-Fa-f]{3}))?(,(white|black|red|blue|green|yellow|magenta|cyan|[0-9]+|#[0-9A-Fa-f]{6}|#[0-9A-Fa-f]{3}))?)\>" @@ -24,7 +29,7 @@ icolor yellow "^[[:space:]]*i?color[[:space:]]+((bold|italic|reverse|underline)( icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)=" # Comments -color brightblue "(^|[[:space:]]+)#.*$" +color brightblue "^[[:space:]]*#.*$" color cyan "^[[:space:]]*##.*$" # Trailing whitespace -- 2.13.6