From 74c48dd85cc8913f297056e41d873e7dc2100d82 Mon Sep 17 00:00:00 2001 From: Jeppe Fihl-Pearson Date: Sat, 27 Jul 2019 08:53:05 +0100 Subject: [PATCH 1/3] Support all the .nanorc keywords The list was taken from https://www.nano-editor.org/dist/latest/nanorc.5.html. Previously the list of keywords were split into two regexes, this didn't seem to serve any purpose besides making the code harder to read, so I have collapsed them together into one. --- nanorc.nanorc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanorc.nanorc b/nanorc.nanorc index 1c9b7c7..62e502d 100644 --- a/nanorc.nanorc +++ b/nanorc.nanorc @@ -4,7 +4,7 @@ syntax "Nanorc" "\.?nanorc$" ## Possible errors and parameters icolor brightred "^[[:space:]]*((un)?set|include|syntax|i?color).*$" ## Keywords -icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|constantshow|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|poslog|positionlog|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|speller|suspend|suspendenable|tabsize|tabstospaces|tempfile|undo|view|whitespace|wordbounds)\>" +icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|backupdir|boldtext|brackets|breaklonglines|casesensitive|constantshow|cutfromcursor|emptyline|errorcolor|fill|functioncolor|guidestripe|historylog|jumpyscrolling|keycolor|linenumbers|locking|matchbrackets|morespace|mouse|multibuffer|noconvert|nohelp|nonewlines|nopauses|nowrap|numbercolor|operatingdir|positionlog|preserve|punct|quickblank|quotestr|rawsequences|rebinddelete|regexp|selectedcolor|showcursor|smarthome|smooth|softwrap|speller|statuscolor|stripecolor|suspend|tabsize|tabstospaces|tempfile|titlecolor|trimblanks|unix|view|whitespace|wordbounds|wordchars|zap)\>" icolor green "^[[:space:]]*(bind|set|unset|syntax|header|include|magic)\>" ## Colors icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>" From c336296fe1d7e913cad074f47644c852990bfb57 Mon Sep 17 00:00:00 2001 From: Jeppe Fihl-Pearson Date: Sat, 27 Jul 2019 08:56:57 +0100 Subject: [PATCH 2/3] Add "normal" to the list of highlighted colors It's an allowed color as per https://www.nano-editor.org/dist/latest/nanorc.5.html. --- nanorc.nanorc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanorc.nanorc b/nanorc.nanorc index 62e502d..2afaafe 100644 --- a/nanorc.nanorc +++ b/nanorc.nanorc @@ -7,7 +7,7 @@ icolor brightred "^[[:space:]]*((un)?set|include|syntax|i?color).*$" icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|backupdir|boldtext|brackets|breaklonglines|casesensitive|constantshow|cutfromcursor|emptyline|errorcolor|fill|functioncolor|guidestripe|historylog|jumpyscrolling|keycolor|linenumbers|locking|matchbrackets|morespace|mouse|multibuffer|noconvert|nohelp|nonewlines|nopauses|nowrap|numbercolor|operatingdir|positionlog|preserve|punct|quickblank|quotestr|rawsequences|rebinddelete|regexp|selectedcolor|showcursor|smarthome|smooth|softwrap|speller|statuscolor|stripecolor|suspend|tabsize|tabstospaces|tempfile|titlecolor|trimblanks|unix|view|whitespace|wordbounds|wordchars|zap)\>" icolor green "^[[:space:]]*(bind|set|unset|syntax|header|include|magic)\>" ## Colors -icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>" +icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>" icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)=" ## Strings icolor white ""(\\.|[^"])*"" From 4e028d3454ebea89f53773f646c93215c1695d6d Mon Sep 17 00:00:00 2001 From: Jeppe Fihl-Pearson Date: Sat, 27 Jul 2019 08:58:17 +0100 Subject: [PATCH 3/3] Add highlighting of colors after "set " This required the color highlighting to happen before the keywords were highlighted as ERE doesn't support non-capturing groups. --- nanorc.nanorc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nanorc.nanorc b/nanorc.nanorc index 2afaafe..b951127 100644 --- a/nanorc.nanorc +++ b/nanorc.nanorc @@ -3,12 +3,13 @@ syntax "Nanorc" "\.?nanorc$" ## Possible errors and parameters icolor brightred "^[[:space:]]*((un)?set|include|syntax|i?color).*$" -## Keywords -icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|backupdir|boldtext|brackets|breaklonglines|casesensitive|constantshow|cutfromcursor|emptyline|errorcolor|fill|functioncolor|guidestripe|historylog|jumpyscrolling|keycolor|linenumbers|locking|matchbrackets|morespace|mouse|multibuffer|noconvert|nohelp|nonewlines|nopauses|nowrap|numbercolor|operatingdir|positionlog|preserve|punct|quickblank|quotestr|rawsequences|rebinddelete|regexp|selectedcolor|showcursor|smarthome|smooth|softwrap|speller|statuscolor|stripecolor|suspend|tabsize|tabstospaces|tempfile|titlecolor|trimblanks|unix|view|whitespace|wordbounds|wordchars|zap)\>" -icolor green "^[[:space:]]*(bind|set|unset|syntax|header|include|magic)\>" ## Colors icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>" icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)=" +icolor yellow "^[[:space:]]*(set|unset)[[:space:]]+(errorcolor|functioncolor|keycolor|numbercolor|selectedcolor|statuscolor|stripecolor|titlecolor)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan|normal)?(,(white|black|red|blue|green|yellow|magenta|cyan|normal))?\>" +## Keywords +icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|backupdir|boldtext|brackets|breaklonglines|casesensitive|constantshow|cutfromcursor|emptyline|errorcolor|fill|functioncolor|guidestripe|historylog|jumpyscrolling|keycolor|linenumbers|locking|matchbrackets|morespace|mouse|multibuffer|noconvert|nohelp|nonewlines|nopauses|nowrap|numbercolor|operatingdir|positionlog|preserve|punct|quickblank|quotestr|rawsequences|rebinddelete|regexp|selectedcolor|showcursor|smarthome|smooth|softwrap|speller|statuscolor|stripecolor|suspend|tabsize|tabstospaces|tempfile|titlecolor|trimblanks|unix|view|whitespace|wordbounds|wordchars|zap)\>" +icolor green "^[[:space:]]*(bind|set|unset|syntax|header|include|magic)\>" ## Strings icolor white ""(\\.|[^"])*"" ## Comments