🍻 beer(klipper-conf): attempted to define the klipper config format

This is probably wrong, but I wanted to hang on to it for now, until I can get a working solution.
This commit is contained in:
2024-08-17 00:34:28 -04:00
parent f78f142ea6
commit 1587ef5fed
+23
View File
@@ -0,0 +1,23 @@
local api = vim.api
-- Clear any existing syntax rules
api.nvim_command("syntax clear")
-- Default to INI syntax highlighting
api.nvim_command("runtime! syntax/ini.vim")
-- Define gcode region
api.nvim_command(
'syntax region klipperGcode start="^\\s*gcode:" end="^\\S" keepend contains=klipperJinja,klipperJinjaCondition'
)
-- Define Jinja highlighting within gcode
api.nvim_command('syntax region klipperJinja start="{" end="}" contained')
api.nvim_command(
'syntax region klipperJinjaCondition start="{%" end="%}" contained'
)
-- Apply custom highlighting
api.nvim_command("highlight link klipperGcode Identifier")
api.nvim_command("highlight link klipperJinja Conditional")
api.nvim_command("highlight link klipperJinjaCondition Statement")