Skip to content

Instantly share code, notes, and snippets.

@brainary
Created April 3, 2022 17:57
Show Gist options
  • Save brainary/a5792467e931e4466fdb79b8b18486ae to your computer and use it in GitHub Desktop.
Save brainary/a5792467e931e4466fdb79b8b18486ae to your computer and use it in GitHub Desktop.
First attempt of syntax-highlighting of [x]it! on Nano
syntax "xit" "\.xit$"
tabgives " "
## Not matched - Errors
color ,red "^.*$"
## Headlines
# Version 5+
color bold,normal "^[a-zA-Z0-9][a-zA-Z0-9 ]*$"
# Version 4
#color normal "^[a-zA-Z0-9][a-zA-Z0-9 ]*$"
## Description
# Active
color normal start="^\[ \] .*$" end="(^\[(x|@|~)\]|^$)"
# Done
color brightblack start="^\[x\] .*$" end="(^\[( |@|~)\]|^$)"
# Ongoing
color normal start="^\[@\] .*$" end="(^\[( |x|~)\]|^$)"
# Obsolete
color brightblack start="^\[~\] .*$" end="(^\[( |x|@)\]|^$)"
## Priorities
color red "^\[( |x|@|~)\] (!*\.*|\.*!*) "
## Checkboxes
# Active
color brightcyan "^\[ \] "
# Done
color brightgreen "^\[x\] "
# Ongoing
color brightmagenta "^\[@\] "
# Obsolete
color brightblack "^\[~\] "
## Due Dates
color brightyellow "-> [0-9]{4}((-|/)(W[0-9]+|Q[0-9]|[0-9]{2}((-|/)([0-9]{2}))?))?"
## Tags
color cyan "#[A-Za-z0-9]+"
color cyan "#[A-Za-z0-9]+=[A-Za-z0-9]+"
color cyan "#[A-Za-z0-9]+=\"[^\"]+\""
color cyan "#[A-Za-z0-9]+='[^']+'"
## Errors Override
color ,red "^[ ]{1,3}[^ ]*$"
@jotaen
Copy link

jotaen commented Apr 3, 2022

For reference, the original discussion.

@beevomit
Copy link

@brainary You may want to consider doing a pull request and adding this to the https://github.com/scopatz/nanorc repository? It would be a great addition to it.

Thank you for creating this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment