🍻 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:
@@ -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")
|
||||||
Reference in New Issue
Block a user