zyedidia / micro

A modern and intuitive terminal-based text editor

Home Page:https://micro-editor.github.io

Repository from Github https://github.comzyedidia/microRepository from Github https://github.comzyedidia/micro

Micro's V Lang color-coding could be improved.

codemanticism opened this issue · comments

There are some keywords in V (URL) which are not supported by Micro's color-coding. Here is my attempt at rewriting the .YAML file:

filetype: vlang

detect:
    filename: "\\.v$"

rules:
      # Conditionals and control flow
    - preproc: "\\b(module|import)\\b"
    - statement: "\\b(if|else|for|match|select|defer|or|unsafe|while|asm|defer|go|goto|lock|match|or|rlock|select|spawn|unsafe)\\b"
    - statement: "\\b(sizeof|typeof)\\b"
    - statement: "\\b(break|continue|goto|return)\\b"
    - statement: "\\b(as|in|is)\\b"
    - type.keyword: "\\b(assert|const|enum|fn|struct|interface|type|implements|shared|static|union|volatile)\\b"
    - type.keyword: "\\b(pub|mut|__global|__offsetof)\\b"

    - preproc: "\\$\\b(if|else)\\b"
    - identifier.os: "\\b(mac|macos|linux|windows|freebsd|openbsd|netbsd|dragonfly|android|solaris|haiku)\\b"
    - identifier.compiler: "\\b(gcc|tinyc|clang|mingw|msvc|cplusplus)\\b"
    - identifier.platform: "\\b(amd64|aarch64|x64|x32|little_endian|big_endian)\\b"
    - identifier.other: "\\b(debug|test|js|glibc|prealloc|no_bounds_checking)\\b"
    - constant.bool: "\\b(true|false)\\b"
    - constant.none: "\\b(none)\\b"

    - constant.string:
        start: "`"
        end: "`"
        skip: "\\\\."
        rules:
            - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})"

    - constant.string:
        start: "'"
        end: "'"
        skip: "\\\\."
        rules:
            - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})"

    - constant.string:
        start: "\""
        end: "\""
        skip: "\\\\."
        rules:
            - constant.specialChar: "\\\\([\"'abfnrtv\\\\]|[0-3]?[0-7]{1,2}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})"

    # Brackets
    - symbol.brackets: "(\\{|\\})"
    - symbol.brackets: "(\\(|\\))"
    - symbol.brackets: "(\\[|\\])"

      # Numbers and strings
    - constant.number: "\\b(0b[01_]+)\\b"
    - constant.number: "\\b(0o[0-7_]+)\\b"
    - constant.number: "\\b(0x[0-9a-fA-F_]+)\\b"
    - constant.number: "\\b([0-9_]+)\\b"
    - comment:
        start: "//"
        end: "$"
        rules:
            - todo: "(TODO|XXX|FIXME):?"

    - comment:
        start: "/\\*"
        end: "\\*/"
        rules:
            - todo: "(TODO|XXX|FIXME):?"

Can you please provide your suggestion directly as PR1?
The diff can then be reviewed accordingly and merged in case there are no issues with it.

Footnotes

  1. https://github.blog/developer-skills/github/beginners-guide-to-github-creating-a-pull-request/