Auto commit: 2024-11-08 00:15:02
This commit is contained in:
parent
6c28b653f9
commit
b56c191f85
1 changed files with 12 additions and 7 deletions
|
@ -26,15 +26,20 @@ end
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = "markdown",
|
pattern = "markdown",
|
||||||
callback = function()
|
callback = function()
|
||||||
-- Define syntax regions for inline math
|
-- Enable concealment for inline and block math
|
||||||
vim.cmd([[syntax match markdownMathInline '\\$[^$].\{-}\$']])
|
vim.opt_local.conceallevel = 2
|
||||||
vim.cmd([[syntax region markdownMathBlock start=/\\$\\$/ end=/\\$\\$/]])
|
vim.opt_local.concealcursor = "nc"
|
||||||
|
|
||||||
-- Set both inline and block math to 'tex' filetype
|
-- Define regions for inline and block math to be treated as `tex`
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
syntax match tex '\\$[^$].\{-}\$'
|
syntax region texMathInline matchgroup=texMath start="\\$" skip="\\\\\\$" end="\\$" concealends
|
||||||
syntax region tex start=/\\$\\$/ end=/\\$\\$/
|
syntax region texMathBlock matchgroup=texMath start="\\$\\$" end="\\$\\$" concealends
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
-- Set syntax highlighting for these regions to `tex`
|
||||||
|
vim.cmd("highlight link texMath texMathZone")
|
||||||
|
vim.cmd("highlight link texMathInline texMathZone")
|
||||||
|
vim.cmd("highlight link texMathBlock texMathZone")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue