diff --git a/syntax/gentoo.nanorc b/syntax/gentoo.nanorc index a47632e3..eb2877bb 100644 --- a/syntax/gentoo.nanorc +++ b/syntax/gentoo.nanorc @@ -1,19 +1,20 @@ -## Here is an example for Gentoo ebuilds/eclasses. +## Here is an example for Gentoo ebuilds/eclasses, +## and (further down) one for Portage control files. syntax "ebuild" "\.e(build|class|blit)$" comment "#" -## All the standard portage functions +## All the standard portage functions: color brightgreen "(^|\" color brightgreen "^pkg_(config|nofetch|info|pretend|setup|(pre|post)(inst|rm))\>" color brightgreen "\" -## Highlight bash related syntax +## Bash-related syntax: color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>" color green "\<(declare|eval|exec|export|let|local)\>" color green "[{}():;|`$<>!=&\\]" "(\]|\[)" color green "-[defhnrsuwxzL]\>" color green "-(eq|ne|gt|lt|ge|le)\>" -## Highlight variables ... official portage ones in red, all others in bright red +## Variables... official portage ones in red, all others in bright red: color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*" color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:digit:]]|@)+\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})" color red "\<(EAPI|ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|[HPR]?DEPEND|PROVIDE|PROPERTIES|REQUIRED_USE|RESTRICT|USERLAND)\>" @@ -22,7 +23,7 @@ color red "\<(AS|C(PP|XX)?|LD)FLAGS\>" "\" "\<(MERGE_TYPE color red "\" color red "\" color red "\<(PATCHES|(HTML_)?DOCS)\>" "\" "\" -## Highlight portage commands +## Portage commands: color magenta "\<(use(_(with|enable|if_iuse)|x)?|in_iuse)\> [!a-zA-Z0-9_+ -]*" "inherit.*" color brightblue "\" color brightblue "\" "\" @@ -35,20 +36,21 @@ color brightblue "\" "\" "\<(f|games)(owners|perms)\>" "\<(exe|ins|dir)opts\>" color brightblue "\" color brightblue "\" -## Highlight common commands used in ebuilds +## Common commands used in ebuilds: color blue "\<(awk|cat|cd|chmod|chown|cp|echo|env|find|e?grep|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|tar|touch|unset|xargs)\>" -## Highlight comments (doesnt work that well) +## Comments (doesn't work that well): color yellow "(^|[[:space:]])#.*$" -## Highlight strings (doesnt work that well) +## Strings (doesn't work that well): color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'" ## Trailing space is bad! color ,green "[[:space:]]+$" ## Mixed whitespace is also bad. color ,green " " -## Here is an example for Portage control files. -## + syntax "/etc/portage" "\.(accept_keywords|env|keywords|mask|unmask|use)(/.+)?$" +comment "#" + ## Base text: color green "^.+$" ## Likely version and slot numbers: