From 93f0691b06305baaba5d604141f0b7572fabd900 Mon Sep 17 00:00:00 2001 From: BluishHumility Date: Sat, 11 Nov 2023 10:27:16 -0500 Subject: [PATCH] feat(garuda-common-settings): add syntax highlighting for configs in micro Add syntax highlighting for config files opened in Micro that don't directly call a shell. * Add a syntax definition for `filetype: conf` in `syntax/conf.yaml` with some basic rules (for example, highlighting commented lines); * Define `/etc/*` and `/home/*/.config/*` as conf filetype in `settings.json`, because they contain a lot of config files that don't end in ".conf" or ".cfg". --- etc/skel/.config/micro/settings.json | 6 ++++++ etc/skel/.config/micro/syntax/conf.yaml | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 etc/skel/.config/micro/syntax/conf.yaml diff --git a/etc/skel/.config/micro/settings.json b/etc/skel/.config/micro/settings.json index 7551ae9..cf011de 100644 --- a/etc/skel/.config/micro/settings.json +++ b/etc/skel/.config/micro/settings.json @@ -1,4 +1,10 @@ { + "/etc/*": { + "filetype": "conf" + }, + "/home/*/.config/*": { + "filetype": "conf" + }, "autosu": true, "colorscheme": "geany", "mkparents": true diff --git a/etc/skel/.config/micro/syntax/conf.yaml b/etc/skel/.config/micro/syntax/conf.yaml new file mode 100644 index 0000000..c5e24d8 --- /dev/null +++ b/etc/skel/.config/micro/syntax/conf.yaml @@ -0,0 +1,18 @@ +filetype: conf + +detect: + filename: "(\\.(conf)$|\\.(cfg)$)" + +rules: + - constant.string: + start: "\"" + end: "\"" + skip: "\\\\." + rules: + - constant.specialChar: "\\\\." + + - comment: + start: "#" + end: "$" + rules: + - todo: "(TODO|XXX|FIXME):?"