Live math previews as images inside Neovim.
- Replaces source math with rendered images seamlessly inside Neovim.
- Low latency preview that updates live while typing.
- Supports Typst in
markdownwith$inline$or$$display$$blocks.
- Neovim >= 0.11
- Typst
- Tree-sitter with
markdown,markdown_inline, andlatexparsers
- WezTerm (tracking issue): Missing unicode placeholders.
- Konsole (related issue): Missing unicode placeholders.
- Warp (tracking issue): Missing unicode placeholders.
- xterm.js (tracking issue): Missing unicode placeholders.
- Alacritty (tracking issue)
- Zellij (tracking issue)
mathlive.nvim auto-initializes with sensible defaults. No setup() call is required unless you want to change the default configuration.
vim.pack.add({
"https://github.com/saadndm/mathlive.nvim",
})return {
"saadndm/mathlive.nvim",
lazy = false, -- the plugin lazy-loads itself
};require("mathlive").setup({
-- Filetypes where mathlive should attach.
-- Set to {} to disable automatic attachment.
filetypes = { "markdown" },
-- Formula foreground color.
-- If empty, falls back to the highlight groups:
-- @markup.math.latex, Special or Normal, in that order.
color_hex = "", -- Example: "#ffffff"
-- Pixel density used when Typst renders PNGs.
ppi = 300,
-- Typst code inserted before each formula.
-- Use this to customize how Typst renders math.
preamble = [[]],
-- Multiplier for formula size relative to terminal cell height.
-- 1.0 makes rendered text roughly match Neovim's text size.
text_scale = 1.0,
})require("markview").setup({
preview = {
enable_hybrid_mode = true,
linewise_hybrid_mode = false,
debounce = 1,
modes = { "n", "i", "v", "c" },
hybrid_modes = { "n", "i", "v", "c" },
callbacks = {
on_enable = function (_, win)
vim.wo[win].conceallevel = 3
vim.wo[win].concealcursor = "nvic"
end,
on_mode_change = function (_, win)
vim.wo[win].conceallevel = 3
vim.wo[win].concealcursor = "nvic"
end,
on_hybrid_enable = function (_, win)
vim.wo[win].conceallevel = 3
vim.wo[win].concealcursor = "nvic"
end
}
},
typst = {
math_blocks = { enable = false },
math_spans = { enable = false },
symbols = { enable = false },
code_blocks = { enable = false },
superscripts = { enable = false },
subscripts = { enable = false },
},
latex = {
blocks = { enable = false },
inlines = { enable = false },
symbols = { enable = false },
superscripts = { enable = false },
subscripts = { enable = false },
commands = { enable = false },
fonts = { enable = false },
},
})require("render-markdown").setup({
win_options = {
concealcursor = { rendered = "nvic" }
},
latex = { enabled = false }
})- Document/Implement autocomplete via otter.nvim.
- Document/Implement formatting inside math blocks via conform.nvim.
- LaTeX support via tylax.
wrapsupport (blocked by this neovim issue).- Replace the
typstCLI dependency with typst-lua lua bindings.
- Inspired by markview.nvim.
- The Kitty graphics renderer is adapted from snacks.nvim.