Skip to content

Commit

Permalink
feat: Add syntax highlight file for GNU nano (#4560)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
vanillajonathan and pre-commit-ci[bot] authored Jun 8, 2024
1 parent ff492a5 commit f718695
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
15 changes: 15 additions & 0 deletions grammars/nano/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Syntax highlighting for GNU nano

This is a syntax highlighting file the [GNU nano](https://nano-editor.org/) text
editor.

## Installation

To install place the `prql.nanorc` file in the `~/.nano/` directory and and
include the following line in your `.nanorc` file.

include "~/.nano/prql.nanorc"

You can append it with this command:

echo 'include "~/.nano/prql.nanorc"' >> ~/.nanorc
39 changes: 39 additions & 0 deletions grammars/nano/prql.nanorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Syntax highlighting for PRQL.

syntax python "\.prql$"
magic "PRQL script"
comment "#"

# Types.
color green "\<(int(8|16|32|64|128)?|float(32|64)|bool|text|date|time|timestamp)\>"

# Keywords.
color yellow "\<let|module|prql\>"

# Transforms.
color brightcyan "\<(aggregate|derive|filter|from|group|join|select|sort|take|window)\>"

# Special values.
color brightmagenta "\<(false|null|true|this|that)\>"

# Decorators.
color cyan start="@\{" end="\}"

# Mono-quoted strings.
color brightgreen "[frs]?'([^'\]|\\.)*'|[frs]?"([^"\]|\\.)*"|'''|""""
color normal "'''|""""
# Comments.
color gray "(^|[[:blank:]])#.*"
# Triple-quoted strings.
color brightgreen start="[frs]?'''([^'),]|$)" end="(^|[^(\])'''"
color brightgreen start="[frs]?"""([^"),]|$)" end="(^|[^(\])""""
# Backslash escapes.
color lime "\\($|[\'"bfnrt]|[0-3]?[0-7]?[0-7]|x[[:xdigit:]]{2})"
color lime "\\(N\{[[:alpha:]]+\}|u\{[[:xdigit:]]{1,6}\})"
# Reminders.
color brightwhite,yellow "\<(FIXME|TODO)\>"
# Trailing whitespace.
color ,green "[[:space:]]+$"

0 comments on commit f718695

Please sign in to comment.