Skip to content
Discussion options

You must be logged in to vote

No plugin is required, but a colorscheme alone cannot distinguish them with the current built-in JSON syntax: both keys and string values are initially matched as constant.string.
A practical workaround is to override the JSON syntax definition. Create:

~/.config/micro/syntax/json.yaml

filetype: json

detect:
  filename: "\\.json$"
  header: "^\\s*\\{"

rules:
  - constant.number: "\\b-?(0|[1-9][0-9]*)(\\.[0-9]+)?([eE][+-]?[0-9]+)?\\b"
  - constant: "\\b(null|true|false)\\b"
  - constant.string: '"(\\.|[^"\\])*"'
  - statement: '"(\\.|[^"\\])*"[[:space:]]*:'
  - constant.specialChar: '\\(u[0-9a-fA-F]{4}|["\\/bfnrt])'

Micro applies later pattern rules over earlier ones, so string values re…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sgon00
Comment options

Answer selected by sgon00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants