Skip to content

Instantly share code, notes, and snippets.

@clausecker
Last active March 29, 2017 14:18
Show Gist options
  • Save clausecker/6690362 to your computer and use it in GitHub Desktop.
Save clausecker/6690362 to your computer and use it in GitHub Desktop.
nanorc file for go
syntax "go" "\.go$"
# types
color green "\<(bool|u?int(8|16|32|64)?|float(32|64)|complex(64|128)|byte|rune|uintptr|string|error)\>"
color green "\<((<-[[:space:]]*)chan|chan[[:space:]]*<-|const|func|interface|map|struct|type|var)\>"
# predefined functions
color blue "\<(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\>"
# control flow
color magenta "\<(break|continue|fallthrough|goto|return)\>"
# declarations
color brightcyan "\<(package|import)\>"
color brightcyan "//[[:space:]]*\+build[[:space:]]+(([a-zA-Z_0-9]+[[:space:]]*)+,[[:space:]]*)*[a-zA-Z_0-9]+"
# control structures
color brightyellow "\<(case|default|defer|else|for|go|if|range|select|switch)\>"
# literals
color red "\<[0-9]+\.[0-9]*([Ee][+-][0-9]+)?i?\>"
color red "\<[0-9]+[Ee][+-][0-9]+i?\>"
color red "\<\.[0-9]+([Ee][+-][0-9]+)?i?\>"
color red "\<[0-9]+i\>"
color red "\<[1-9][0-9]*\>"
color red "\<0[0-7]*\>"
icolor red "\<0x[0-9a-f]+\>"
# strings and characters; slightly fuzzy
color red "\<(true|false|nil|iota|_)\>"
color red "'(\\.|[^'])+'"
color red ""(\\.|[^"])*""
color red start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
color brightblue "//.*"
color brightblue start="/\*" end="\*/"
color ,green "[[:space:]]+$"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment