Fork 0

Initial commit of nanorc. Any nano users out there, feel free to submit improvements

This commit is contained in:
sloum 2021-09-16 13:55:57 -07:00
commit efd22e4594
3 changed files with 62 additions and 0 deletions

Makefile Normal file
View File

@ -0,0 +1,13 @@
LANGNAME := slope
ROOT := ~/.local/share/nano
SYN := /syntax
.PHONY: install
install: ./${LANGNAME}.nanorc
install -d ${ROOT}${SYN}
install -m 0644 ${LANGNAME}.nanorc ${ROOT}${SYN}
@printf "\ninclude %s\n" ${ROOT}${SYN}/${LANGNAME}.nanorc >> ~/.nanorc
.PHONY: remove
rm -rf ${ROOT}${SYN}/${LANGNAME}.nanorc

README.md Normal file
View File

@ -0,0 +1,18 @@
# slope syntax for nano
This, as the title suggests, is a syntax highlighting file for the [nano text editor](https://en.wikipedia.org/wiki/GNU_nano).
It is a simplified highlighting syntax in comparrison to the [slope vim syntax](https://git.rawtext.club/slope-lang/slope-vim-syntax), but should make things much nicer to work with that using nano without it.
Installation is simple:
``` sh
This will do the following:
- Copy the syntax file to `~/.local/share/nano/syntax/slope.nanorc`, creating this folder structure if need be
- Append `include ~/.local/share/nano/syntax/slope.nanorc` to your `~/.nanorc` file
- There is a make target, `make remove`. This will remove the `slope.nanorc` file, but will _not_ attempt to remove the include from your `.nanorc` (in order to safeguard your file)

slope.nanorc Normal file
View File

@ -0,0 +1,31 @@
syntax "slope" "\.slo$"
header "^#!.*slo"
comment ";"
# Special forms
color green "\<(lambda|quote|and|or|begin|begin0|filter|list|length|assoc|filter|map|car|cdr|cons)\>"
color red "\<\!\>"
# Defining things
color brightcyan "\<(define|set!|if|cond|load|load-mod|load-mod-file)\>"
# Booleans
color brightyellow "(\#t|\#f)"
# Integers
color brightmagenta "(\b|-)[0-9]+[iL]?\b"
# Floating-point numbers
color brightmagenta "(\b|-)([0-9]+[Ee][-+]?[0-9]+|([0-9]*\.[0-9]+|[0-9]+\.)([Ee][-+]?[0-9]+)?)[i]?\b"))"
# Constants
color blue "\<(PI|E|PHI|sys-args|stdin|stdout|stderr|devnull)\>"
# Strings
color yellow start="^[[:blank:]]+\"" end="[^\]\""
color yellow ""(\\.|[^"])*""
# Comments
color cyan ";.*$"