This commit is contained in:
2025-01-04 09:39:34 -05:00
parent 0918edd065
commit f1ae75032b
2 changed files with 28 additions and 7 deletions

View File

@@ -0,0 +1,23 @@
local fn = vim.fn
-- Function to add keyword highlighting
local function keywordsadd(keywords)
local pattern = "\\<\\(" .. table.concat(keywords, "\\|") .. "\\)\\>"
fn.matchadd("Keyword", pattern)
end
local function setup_highlight_groups()
vim.api.nvim_set_hl(0, "ftl_Keyword", { link = "Keyword" })
vim.api.nvim_set_hl(0, "ftl_String", { link = "String" })
vim.api.nvim_set_hl(0, "ftl_Comment", { link = "Comment" })
vim.api.nvim_set_hl(0, "ftl_Number", { link = "Number" })
end
setup_highlight_groups()
-- Add custom highlights
keywordsadd { "if", "else", "while", "for", "SYSCALL", "exit" }
fn.matchadd("ftl_Keyword", "\\<\\(if\\|else\\|while\\|for\\|SYSCALL\\|exit\\)\\>")
fn.matchadd("ftl_String", [["\zs[^"]*\ze"]])
fn.matchadd("ftl_Comment", [[;;.*]])
fn.matchadd("ftl_Number", [[\v<\d+>]])

View File

@@ -1,13 +1,11 @@
vim.g.mapleader = " " vim.g.mapleader = " "
-- https://github.com/vx-clutch/ftl -- https://github.com/vx-clutch/ftl
vim.api.nvim_create_autocmd({"BufNewFile", "BufRead"}, { vim.filetype.add {
pattern = "*.ftl", extension = {
callback = function() ftl = "ftl",
vim.bo.filetype = "c" },
end, }
})
require "vxclutch.set" require "vxclutch.set"
require "vxclutch.lazy_init" require "vxclutch.lazy_init"