>From 12964fae93f1c2cb483e5611ff35a5f60ae0f926 Mon Sep 17 00:00:00 2001 From: Brand Huntsman Date: Thu, 15 Feb 2018 15:14:15 -0700 Subject: [PATCH 5/6] 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 ac028095..0c371a4c 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|(bold,)?((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|(bold,)?((bright)?(white|bl icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)=" # Comments -color brightblue "(^|[[:space:]]+)#.*$" +color brightblue "^[[:space:]]*#.*$" color cyan "^[[:space:]]*##.*$" # Trailing whitespace -- 2.13.6