Skip to content

Instantly share code, notes, and snippets.

@clausecker
Last active March 29, 2017 14:18

Revisions

  1. @fuzxxl fuzxxl revised this gist Sep 24, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions golang.nanorc
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,7 @@ 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)\>"
  2. @fuzxxl fuzxxl revised this gist Sep 24, 2013. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions golang.nanorc
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,9 @@ syntax "go" "\.go$"
    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)\>"

    @@ -19,7 +22,8 @@ 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]*\>"
    icolor red "\<0[0-7]*" "0x[0-9a-f]+\>"
    color red "\<0[0-7]*\>"
    icolor red "\<0x[0-9a-f]+\>"

    # strings and characters; slightly fuzzy
    color red "\<(true|false|nil|iota|_)\>"
    @@ -30,7 +34,4 @@ color red start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
    color brightblue "//.*"
    color brightblue start="/\*" end="\*/"

    # predefined functions
    color blue "\<(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\>"

    color ,green "[[:space:]]+$"
  3. @fuzxxl fuzxxl created this gist Sep 24, 2013.
    36 changes: 36 additions & 0 deletions golang.nanorc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    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)\>"

    # control flow
    color magenta "\<(break|continue|fallthrough|goto|return)\>"

    # declarations
    color brightcyan "\<(package|import)\>"

    # 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]*\>"
    icolor red "\<0[0-7]*" "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="\*/"

    # predefined functions
    color blue "\<(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)\>"

    color ,green "[[:space:]]+$"