Skip to content

Commit

Permalink
feat(markdown-preview-nvim): add mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
cristobalgvera committed Sep 2, 2024
1 parent 2932a1b commit 53dea1c
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
---@type LazySpec
return {
"iamcco/markdown-preview.nvim",
build = function() vim.fn["mkdp#util#install"]() end,
ft = { "markdown", "markdown.mdx" },
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
init = function()
local plugin = require("lazy.core.config").spec.plugins["markdown-preview.nvim"]
vim.g.mkdp_filetypes = require("lazy.core.plugin").values(plugin, "ft", true)
end,
dependencies = {
{ "AstroNvim/astroui", opts = { icons = { Markdown = "" } } },
{
"AstroNvim/astrocore",
optional = true,
opts = function(_, opts)
local maps = opts.mappings
local prefix = "<Leader>M"

maps.n[prefix] = { desc = require("astroui").get_icon("Markdown", 1, true) .. "Markdown" }
maps.n[prefix .. "p"] = { "<cmd>MarkdownPreview<cr>", desc = "Preview" }
maps.n[prefix .. "s"] = { "<cmd>MarkdownPreviewStop<cr>", desc = "Stop preview" }
maps.n[prefix .. "t"] = { "<cmd>MarkdownPreviewToggle<cr>", desc = "Toggle preview" }
end,
},
},
}

0 comments on commit 53dea1c

Please sign in to comment.