Skip to content

Instantly share code, notes, and snippets.

@pabloab
Last active July 20, 2023 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pabloab/0a532be47e5cf9e12e396cd79d7feabc to your computer and use it in GitHub Desktop.
Save pabloab/0a532be47e5cf9e12e396cd79d7feabc to your computer and use it in GitHub Desktop.
Sublime syntax for MARC line mode files (yaz-marcdump), used by syntect and therefore by bat
%YAML 1.2
---
# By Pablo Bianchi
name: MARC line mode (yaz-marcdump)
file_extensions:
- line
scope: string
uuid: 222f19a4-f491-4e71-a391-00b138add2a0
contexts:
main:
- match: "^([0-9]{5}.{19})$"
scope: comment
- match: "^(00[0-9]) (.*)$"
captures:
1: constant
2: entity.other.attribute-name
- match: "^([0-9][0-9][0-9]) (..)"
captures:
1: constant.numeric
2: comment
- match: " \\$[a-z0-9] "
scope: keyword
# From https://github.com/sharkdp/bat#adding-new-syntaxes--language-definitions
# `mkdir -p "$(bat --config-dir)/syntaxes"`
# Copy content to `~/.config/bat/syntaxes/line-mode-MARC.sublime-syntax`
# `bat cache --clear; bat cache --build`
# Should be listed on `bat --list-languages`.
# ls ~/.config/bat/syntaxes/line-mode-MARC.sublime-syntax | entr sh -c 'clear && bat cache --build && cat DATABASE-mig.line | bat -l "line"'
# https://www.sublimetext.com/docs/3/syntax.html
# https://www.sublimetext.com/docs/3/scope_naming.html
# entity.name
# entity.other.inherited-class
# entity.name.section
# entity.name.tag
# entity.other.attribute-name green
# variable white
# variable.language white
# variable.parameter orange italic
# variable.function white
# constant cyan
# constant.numeric lila
# constant.language lila
# constant.character.escape lila
# storage.type cyan italic
# storage.modifier magenta
# support light yellow
# keyword magenta
# keyword.control
# keyword.operator
# keyword.declaration
# string
# comment
# invalid
# invalid.deprecated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment