nvim: Change markdown_preview build process

This commit is contained in:
Andreas Tsouchlos 2025-06-17 22:11:51 -04:00
parent 3c76341341
commit 192b290e4a

View File

@ -1,5 +1,5 @@
return {
{
-- Install markdown preview, use npx if available.
"iamcco/markdown-preview.nvim",
cmd = {
"MarkdownPreviewToggle",
@ -9,7 +9,19 @@ return {
ft = {
"markdown"
},
build = function() vim.fn["mkdp#util#install"]() end
build = function(plugin)
if vim.fn.executable "npx" then
vim.cmd("!cd " .. plugin.dir .. " && cd app && npx --yes yarn install")
else
vim.cmd [[Lazy load markdown-preview.nvim]]
vim.fn["mkdp#util#install"]()
end
end,
init = function()
if vim.fn.executable "npx" then
vim.g.mkdp_filetypes = {
"markdown"
}
end
end
}