commit efd22e4594726f8f3c791cf85c27092d539a9d2c Author: sloum Date: Thu Sep 16 13:55:57 2021 -0700 Initial commit of nanorc. Any nano users out there, feel free to submit improvements diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..43fa4f0 --- /dev/null +++ b/Makefile @@ -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 +remove: + rm -rf ${ROOT}${SYN}/${LANGNAME}.nanorc diff --git a/README.md b/README.md new file mode 100644 index 0000000..a766900 --- /dev/null +++ b/README.md @@ -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 +make +``` + +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) + diff --git a/slope.nanorc b/slope.nanorc new file mode 100644 index 0000000..4f43584 --- /dev/null +++ b/slope.nanorc @@ -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 ";.*$" +