37 lines
1 KiB
Lua
37 lines
1 KiB
Lua
return {
|
|
"iamcco/markdown-preview.nvim",
|
|
|
|
build = function()
|
|
vim.fn["mkdp#util#install"]()
|
|
end,
|
|
|
|
cmd = {
|
|
"MarkdownPreview",
|
|
"MarkdownPreviewStop",
|
|
"MarkdownPreviewToggle",
|
|
},
|
|
|
|
ft = "markdown",
|
|
|
|
init = function()
|
|
vim.g.mkdp_theme = "dark"
|
|
|
|
-- Don't close the preview when switching to another buffer.
|
|
vim.g.mkdp_auto_close = 0
|
|
|
|
-- Show preview page URL in command line when opening preview page.
|
|
vim.g.mkdp_echo_preview_url = 1
|
|
|
|
-- Workaround for combination of macOS + Firefox + tmux:
|
|
-- * On macOS, this plugin uses the open(1) command to open the preview
|
|
-- page in a browser.
|
|
-- * For some reason, Firefox cannot be opened with open(1) from within
|
|
-- tmux (tested on macOS 14.5).
|
|
-- * The workaround is therefore to fall back to Safari.
|
|
-- * Run `open -a firefox https://schauenburg.me` from within a tmux
|
|
-- session -> if it works, this workaround is no longer needed.
|
|
if vim.fn.has("mac") and vim.env.TMUX then
|
|
vim.g.mkdp_browser = "safari"
|
|
end
|
|
end,
|
|
}
|