Warning: This plugin is still alpha, expect break changes and bugs!
More powerful conceal for latex code with neovim.

- write with pure lua, and very fast.
- colorful conceal and multichar conceal since we use extmark.
- dynemic conceal, such as concealing
\iteminto the value of counter or use rainbow color for delim. - customizable. You can add your own conceal very easy.
- more flexible and exact since we use tree-sitter instead of string match.
- supporting optional arg and args without curly bracket because I wrote a parse to do it.
- limited support custom parser, so you can write parser for some command like
\verb
nvim-treesitterand parser for latexoptionala nerd font.
For example by lazy.nvim:
{
"dirichy/latex_concealer.nvim",
ft={"tex","latex"},
opts={},
config=true,
}You can pass your own options to opts, here is an example. You can see default value in init.lua:
local concealer= require("latex_concealer.processor.util")
M.config = {
---To handle matched treesitter node
processor_map = {
---command_name can add some simple symbols
command_name = {
["my_custom_command"]={"my_custom_symbol","my_custom_hl_group"}
},
generic_command = {
["my_custom_delim"]=concealer.delim("open","close"),
-- filter is a table or function used in string.gsub
["my_custom_font_command"]=concealer.font({filter,hl}),
["my_custom_command_with_arg"]={
oarg=true,
narg=3,
before=function(buffer,node)
end,
after=function(buffer,node)
end
},
},
---For begin, value is function(buffer,node) to do some counter-related things.
begin = {
enumerate = function(buffer, node)
counter.item_depth_change(buffer, true, 1)
end,
itemize = function(buffer, node)
counter.item_depth_change(buffer, false, 1)
end,
},
---For end, value is function(buffer,node) to do some counter-related things.
["end"] = {
enumerate = function(buffer, node)
counter.item_depth_change(buffer, true, -1)
end,
itemize = function(buffer, node)
counter.item_depth_change(buffer, false, -1)
end,
},
},
---To set concealcursor
conceal_cursor = "nvic",
---Events to refresh
refresh_events = { "InsertLeave", "BufWritePost" },
local_refresh_events = { "TextChangedI", "TextChanged" },
cursor_refresh_events = { "CursorMovedI", "CursorMoved" },
---Something about counters
counter={
---Same as `\the` command in latex, but is turple of string. The second is hl_group to use.
the = {
chapter = { "\\zhnum{chapter}、", "ErrorMsg" },
section = { "\\Roman{chapter}.\\roman{section} ", "Constant" },
subsection = { "\\arabic{chapter}.\\arabic{section}.\\arabic{subsection} ", "DiagnosticHint" },
subsubsection = {
"\\arabic{chapter}.\\arabic{section}.\\arabic{subsection}\\alph{subsubsection} ",
"Special",
},
enumi = { "\\zhdig{section}.\\Roman{enumi}.", "ErrorMsg" },
enumii = { "\\Roman{enumi}.\\Alph{enumii}", "Constant" },
enumiii = { "\\Roman{enumi}.\\Alph{enumii}(\\zhdig{enumiii})", "DiagnosticHint" },
enumiv = { "\\fnsymbol{enumiv}", "Special" },
},
---For unordered list(itemize) conceal.
unordered = {
{ "o", "ErrorMsg" },
{ "-", "Constant" },
{ "+", "DiagnosticHint" },
{ "=", "Special" },
{ "DON'T NEST LIST MORE THAN FOUR LAYER", "ErrorMsg" },
},
}
-- You can set highlight group for every element here
extmark={highlight={relationship="Special",greek="Hint"}}
}