From a66a284004e3f8e03f293f266a442bc447f0f786 Mon Sep 17 00:00:00 2001 From: palto42 Date: Sun, 8 Nov 2020 08:59:58 +0100 Subject: [PATCH 1/5] comment color for visibility on dark terminals --- ini.nanorc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ini.nanorc b/ini.nanorc index d9fcee7..d89f729 100644 --- a/ini.nanorc +++ b/ini.nanorc @@ -6,6 +6,6 @@ color cyan "^[[:space:]]*[^=]*=" color brightmagenta "^[[:space:]]*\[.*\]$" color red "[=;]" color yellow ""(\\.|[^"])*"|'(\\.|[^'])*'" -color brightblack "(^|[[:space:]])(#([^{].*)?|;.*)$" +color brightblue "(^|[[:space:]])(#([^{].*)?|;.*)$" color ,green "[[:space:]]+$" color ,red " + +| + +" From 342d31a7b1f9e21d2a95a4e0a35d3f1449f34927 Mon Sep 17 00:00:00 2001 From: miku86 Date: Thu, 19 Nov 2020 16:49:48 +0100 Subject: [PATCH 2/5] Fix typo: "cotal" => "octal" --- ts.nanorc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ts.nanorc b/ts.nanorc index 1a8d85c..b504c1e 100644 --- a/ts.nanorc +++ b/ts.nanorc @@ -4,7 +4,7 @@ header "^#!.*\/(env +)ts-node" ## Default color white "^.+$" -## Decimal, cotal and hexadecimal numbers +## Decimal, octal and hexadecimal numbers color yellow "\<[-+]?([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 From ed51c7c00cd6ef02e9daf4cc55f96dc375794d63 Mon Sep 17 00:00:00 2001 From: Jip Date: Sat, 21 Nov 2020 23:28:55 +0100 Subject: [PATCH 3/5] Also highlight TypeScript (.ts) as JavaScript As TypeScript extends JavaScript to add types, the basics of JavaScript still apply. This change will parse `.ts` files as if they are JavaScript files, providing basic highlighting support. --- javascript.nanorc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript.nanorc b/javascript.nanorc index 39ce3a0..2cdd4a2 100644 --- a/javascript.nanorc +++ b/javascript.nanorc @@ -1,4 +1,4 @@ -syntax "JavaScript" "\.js$" +syntax "JavaScript" "\.(js|ts)$" comment "//" color blue "\<[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\>" color blue "\<[-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?" From 15de1acdde393e2ba8ffde31996b2223d7374f72 Mon Sep 17 00:00:00 2001 From: palto42 Date: Sun, 22 Nov 2020 11:42:54 +0100 Subject: [PATCH 4/5] systemd .timer & comments color for dark terminal --- systemd.nanorc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/systemd.nanorc b/systemd.nanorc index 888cab8..0a2787a 100644 --- a/systemd.nanorc +++ b/systemd.nanorc @@ -1,12 +1,12 @@ -syntax "Systemd" "\.(service|socket)$" +syntax "Systemd" "\.(service|socket|timer)$" header "^\[Unit\]$" color cyan "^(Accept|After|Alias|AllowIsolate|Also|AmbientCapabilities|ANSI_COLOR|_AUDIT_LOGINUID|_AUDIT_SESSION|Backlog|Before|BindIPv6Only|BindsTo|BindToDevice|BlockIOReadBandwidth|BlockIOWeight|BlockIOWriteBandwidth|_BOOT_ID|Broadcast|BUG_REPORT_URL|BusName|Capabilities|CapabilityBoundingSet|CHASSIS|cipher|class|_CMDLINE|CODE_FILE|CODE_FUNC|CODE_LINE|_COMM|Compress|ConditionACPower|ConditionCapability|ConditionDirectoryNotEmpty|ConditionFileIsExecutable|ConditionFileNotEmpty|ConditionHost|ConditionKernelCommandLine|ConditionNull|ConditionPathExists|ConditionPathExistsGlob|ConditionPathIsDirectory|ConditionPathIsMountPoint|ConditionPathIsReadWrite|ConditionPathIsSymbolicLink|ConditionSecurity|ConditionVirtualization|Conflicts|ControlGroup|ControlGroupAttribute|ControlGroupModify|ControlGroupPersistent|controllers|Controllers|CPE_NAME|CPUAffinity|CPUSchedulingPolicy|CPUSchedulingPriority|CPUSchedulingResetOnFork|CPUShares|CrashChVT|CrashShell|__CURSOR|debug|DefaultControllers|DefaultDependencies|DefaultLimitAS|DefaultLimitCORE|DefaultLimitCPU|DefaultLimitDATA|DefaultLimitFSIZE|DefaultLimitLOCKS|DefaultLimitMEMLOCK|DefaultLimitMSGQUEUE|DefaultLimitNICE|DefaultLimitNOFILE|DefaultLimitNPROC|DefaultLimitRSS|DefaultLimitRTPRIO|DefaultLimitRTTIME|DefaultLimitSIGPENDING|DefaultLimitSTACK|DefaultStandardError|DefaultStandardOutput|Description|DeviceAllow|DeviceDeny|DirectoryMode|DirectoryNotEmpty|Documentation|DumpCore|entropy|Environment|EnvironmentFile|ERRNO|event_timeout|_EXE|ExecReload|ExecStart|ExecStartPost|ExecStartPre|ExecStop|ExecStopPost|ExecStopPre|filter|FONT|FONT_MAP|FONT_UNIMAP|ForwardToConsole|ForwardToKMsg|ForwardToSyslog|FreeBind|freq|FsckPassNo|fstab|_GID|Group|GuessMainPID|HandleHibernateKey|HandleLidSwitch|HandlePowerKey|HandleSuspendKey|hash|HibernateKeyIgnoreInhibited|HOME_URL|_HOSTNAME|ICON_NAME|ID|IdleAction|IdleActionSec|ID_LIKE|ID_MODEL|ID_MODEL_FROM_DATABASE|IgnoreOnIsolate|IgnoreOnSnapshot|IgnoreSIGPIPE|InaccessibleDirectories|InhibitDelayMaxSec|init|IOSchedulingClass|IOSchedulingPriority|IPTOS|IPTTL|JobTimeoutSec|JoinControllers|KeepAlive|KEYMAP|KEYMAP_TOGGLE|KillExcludeUsers|KillMode|KillOnlyUsers|KillSignal|KillUserProcesses|LidSwitchIgnoreInhibited|LimitAS|LimitCORE|LimitCPU|LimitDATA|LimitFSIZE|LimitLOCKS|LimitMEMLOCK|LimitMSGQUEUE|LimitNICE|LimitNOFILE|LimitNPROC|LimitRSS|LimitRTPRIO|LimitRTTIME|LimitSIGPENDING|LimitSTACK|link_priority|valueListenDatagram|ListenFIFO|ListenMessageQueue|ListenNetlink|ListenSequentialPacket|ListenSpecial|ListenStream|LogColor|LogLevel|LogLocation|LogTarget|luks|_MACHINE_ID|MakeDirectory|Mark|MaxConnections|MaxFileSec|MaxLevelConsole|MaxLevelKMsg|MaxLevelStore|MaxLevelSyslog|MaxRetentionSec|MemoryLimit|MemorySoftLimit|MESSAGE|MESSAGE_ID|MessageQueueMaxMessages|MessageQueueMessageSize|__MONOTONIC_TIMESTAMP|MountFlags|NAME|NAutoVTs|Nice|NonBlocking|NoNewPrivileges|NotifyAccess|OnActiveSec|OnBootSec|OnCalendar|OnFailure|OnFailureIsolate|OnStartupSec|OnUnitActiveSec|OnUnitInactiveSec|OOMScoreAdjust|Options|output|PAMName|PartOf|PassCredentials|PassSecurity|PathChanged|PathExists|PathExistsGlob|PathModified|PermissionsStartOnly|_PID|PIDFile|PipeSize|PowerKeyIgnoreInhibited|PRETTY_HOSTNAME|PRETTY_NAME|Priority|PRIORITY|PrivateDevices|PrivateNetwork|PrivateTmp|PropagatesReloadTo|ProtectControlGroups|ProtectHome|ProtectKernelModules|ProtectKernelTunables|ProtectSystem|pss|RateLimitBurst|RateLimitInterval|ReadOnlyDirectories|ReadWriteDirectories|__REALTIME_TIMESTAMP|ReceiveBuffer|RefuseManualStart|RefuseManualStop|rel|ReloadPropagatedFrom|RemainAfterExit|RestrictAddressFamilies|RestrictNamespaces|RestrictRealtime|RequiredBy|Requires|RequiresMountsFor|RequiresOverridable|Requisite|RequisiteOverridable|ReserveVT|ResetControllers|Restart|RestartPreventExitStatus|RestartSec|RootDirectory|RootDirectoryStartOnly|RuntimeKeepFree|RuntimeMaxFileSize|RuntimeMaxUse|RuntimeWatchdogSec|samples|scale_x|scale_y|Seal|SecureBits|_SELINUX_CONTEXT|SendBuffer|SendSIGKILL|Service|ShowStatus|ShutdownWatchdogSec|size|SmackLabel|SmackLabelIPIn|SmackLabelIPOut|SocketMode|Sockets|SourcePath|_SOURCE_REALTIME_TIMESTAMP|SplitMode|StandardError|StandardInput|StandardOutput|StartLimitAction|StartLimitBurst|StartLimitInterval|static_node|StopWhenUnneeded|Storage|string_escape|none|replaceSuccessExitStatus|SupplementaryGroups|SUPPORT_URL|SuspendKeyIgnoreInhibited|SyslogFacility|SYSLOG_FACILITY|SyslogIdentifier|SYSLOG_IDENTIFIER|SyslogLevel|SyslogLevelPrefix|SYSLOG_PID|SystemCallArchitectures|SystemCallFilter|SYSTEMD_ALIAS|_SYSTEMD_CGROUP|_SYSTEMD_OWNER_UID|SYSTEMD_READY|_SYSTEMD_SESSION|_SYSTEMD_UNIT|_SYSTEMD_USER_UNIT|SYSTEMD_WANTS|SystemKeepFree|SystemMaxFileSize|SystemMaxUse|SysVStartPriority|TCPCongestion|TCPWrapName|timeout|TimeoutSec|TimeoutStartSec|TimeoutStopSec|TimerSlackNSec|Transparent|_TRANSPORT|tries|TTYPath|TTYReset|TTYVHangup|TTYVTDisallocate|Type|_UID|UMask|Unit|User|UtmpIdentifier|VERSION|VERSION_ID|WantedBy|Wants|WatchdogSec|What|Where|WorkingDirectory)=" -color brightblue "^\.include\>" +color green "^\.include\>" color red "=" color brightmagenta "^\[(Unit|Install|Service|Socket)\]" color brightyellow "\$MAINPID" color brightcyan "\<(true|false)\>" -color brightblack "(^|[[:space:]])#([^{].*)?$" +color brightblue "(^|[[:space:]])#([^{].*)?$" color ,green "[[:space:]]+$" color ,red " + +| + +" From 88081acf785155c635373f21ef1c7033adabc1ac Mon Sep 17 00:00:00 2001 From: Anders Eknert Date: Thu, 17 Dec 2020 09:42:22 +0100 Subject: [PATCH 5/5] Add support for Rego The policy language of Open Policy Agent. Signed-off-by: Anders Eknert --- rego.nanorc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 rego.nanorc diff --git a/rego.nanorc b/rego.nanorc new file mode 100644 index 0000000..f48673a --- /dev/null +++ b/rego.nanorc @@ -0,0 +1,22 @@ +# Syntax highlighting for Rego (https://www.openpolicyagent.org/) + +syntax "Rego" "\.rego" +comment "#" + +## Reserved words +color cyan "\<(as|default|else|import|package|not|some|with)\>" +color brightblue "\<(false|null|true)\>" + +## Built-ins +### Generated from `cat v0.25.2.json | jq -r .builtins[].name | tr '\n' '|'` +color yellow "\<(abs|all|and|any|array.concat|array.slice|assign|base64.decode|base64.encode|base64.is_valid|base64url.decode|base64url.encode|base64url.encode_no_pad|bits.and|bits.lsh|bits.negate|bits.or|bits.rsh|bits.xor|cast_array|cast_boolean|cast_null|cast_object|cast_set|cast_string|concat|contains|count|crypto.md5|crypto.sha1|crypto.sha256|crypto.x509.parse_certificate_request|crypto.x509.parse_certificates|div|endswith|eq|equal|format_int|glob.match|glob.quote_meta|graph.reachable|gt|gte|hex.decode|hex.encode|http.send|indexof|intersection|io.jwt.decode|io.jwt.decode_verify|io.jwt.encode_sign|io.jwt.encode_sign_raw|io.jwt.verify_es256|io.jwt.verify_es384|io.jwt.verify_es512|io.jwt.verify_hs256|io.jwt.verify_hs384|io.jwt.verify_hs512|io.jwt.verify_ps256|io.jwt.verify_ps384|io.jwt.verify_ps512|io.jwt.verify_rs256|io.jwt.verify_rs384|io.jwt.verify_rs512|is_array|is_boolean|is_null|is_number|is_object|is_set|is_string|json.filter|json.is_valid|json.marshal|json.patch|json.remove|json.unmarshal|lower|lt|lte|max|min|minus|mul|neq|net.cidr_contains|net.cidr_contains_matches|net.cidr_expand|net.cidr_intersects|net.cidr_merge|net.cidr_overlap|numbers.range|object.filter|object.get|object.remove|object.union|opa.runtime|or|plus|product|re_match|regex.find_all_string_submatch_n|regex.find_n|regex.globs_match|regex.is_valid|regex.match|regex.split|regex.template_match|rego.parse_module|rem|replace|round|semver.compare|semver.is_valid|set_diff|sort|split|sprintf|startswith|strings.replace_n|substring|sum|time.add_date|time.clock|time.date|time.now_ns|time.parse_duration_ns|time.parse_ns|time.parse_rfc3339_ns|time.weekday|to_number|trace|trim|trim_left|trim_prefix|trim_right|trim_space|trim_suffix|type_name|union|units.parse_bytes|upper|urlquery.decode|urlquery.decode_object|urlquery.encode|urlquery.encode_object|uuid.rfc4122|walk|yaml.is_valid|yaml.marshal|yaml.unmarshal)\>" + +# Numbers +color purple "\<([0-9]+)\>" + +# Strings +color green ""(\\.|[^"])*"" +color green "`(\\.|[^\\`])*`" + +## Comments +color brightblack "^\s*#.*"