iamcco / markdown-preview.nvim

markdown preview plugin for (neo)vim
MIT License
6.82k stars 284 forks source link

怎么用lazy安装啊 #595

Closed Hello-LuisWu closed 1 year ago

Hello-LuisWu commented 1 year ago

安装参数怎么转换成 lazy的??

qizidog commented 1 year ago
return {
  {
    "iamcco/markdown-preview.nvim",
    build = "cd app && npm install",
    ft = "markdown",
    lazy = true,
    keys = { { "gm", "<cmd>MarkdownPreviewToggle<cr>", desc = "Markdown Preview" } },
    config = function()
      vim.g.mkdp_auto_close = true
      vim.g.mkdp_open_to_the_world = false
      vim.g.mkdp_open_ip = "127.0.0.1"
      vim.g.mkdp_port = "8888"
      vim.g.mkdp_browser = ""
      vim.g.mkdp_echo_preview_url = true
      vim.g.mkdp_page_title = "${name}"
    end,
  },

}
Normanras commented 1 year ago

Woha! Ever since I switched to Lazy I kept getting tslib errors with node and nearly signed off on using this plugin at all. I was just taking one last look at the issues to see what others were posting and your config absolutely saved me. Thank you, @qizidog!

threepotatox commented 1 year ago

How install with lazy.nvim (modified from install with package.nvim):

Or with lazy.nvim

Add this in your init.lua or plugins.lua

-- install without yarn or npm
{
    "iamcco/markdown-preview.nvim",
    build = function() vim.fn["mkdp#util#install"]() end,
}

-- install with yarn or npm
{
    "iamcco/markdown-preview.nvim", build = "cd app && npm install", init = function() vim.g.mkdp_filetypes = { "markdown" } end, ft = { "markdown" },
}