Skip to content

Instantly share code, notes, and snippets.

@lazypwny751
Last active June 13, 2025 21:05
Show Gist options
  • Select an option

  • Save lazypwny751/bc78d2be37e3af50bba958068d785a85 to your computer and use it in GitHub Desktop.

Select an option

Save lazypwny751/bc78d2be37e3af50bba958068d785a85 to your computer and use it in GitHub Desktop.
micro editor syntax configuration for v.
filetype: vlang
detect:
filename: "\\.v$"
rules:
# Module and import
- preproc: "\\b(module|import)\\b"
# Control structures and operators
- statement: "\\b(if|else|for|match|select|defer|or|unsafe|while|asm|go|goto|lock|rlock|spawn)\\b"
- statement: "\\b(sizeof|typeof|as|in|is)\\b"
- statement: "\\b(break|continue|return)\\b"
# Type definitions and keywords
- type.keyword: "\\b(assert|const|enum|fn|struct|interface|type|implements|shared|static|union|volatile)\\b"
- type.keyword: "\\b(pub|mut|__global|__offsetof)\\b"
# Primitive types
- type.primitive: "\\b(voidptr|any|byte|char|rune|string|bool|usize|isize|u8|u16|u32|u64|u128|i8|i16|int|i64|i128|f32|f64)\\b"
# Preprocessor-like platform conditions
- 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"
# Static conditions
- constant.bool: "\\b(true|false)\\b"
- constant.none: "\\b(none)\\b"
# String conditions
- 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: "(\\[|\\])"
# Numeration
- 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"
# Comments
- comment:
start: "//"
end: "$"
rules:
- todo: "(TODO|XXX|FIXME):?"
- comment:
start: "/\\*"
end: "\\*/"
rules:
- todo: "(TODO|XXX|FIXME):?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment