iamcco / markdown-preview.nvim

markdown preview plugin for (neo)vim
MIT License
6.36k stars 268 forks source link

Convert vim-plug installation to Lua #645

Open jianyuchenxyz opened 4 months ago

jianyuchenxyz commented 4 months ago

The vim-plug VimScript instructions to install MarkdownPreview are as follows:

local vim = vim
local Plug = vim.fn['plug#']

Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}

vim.call('plug#end')

I'm looking for help on how I can convert the line beginning with Plug ... into Lua. This particular line errors out, since Lua does not recognize the data between the curly braces.

The installation guide only shows .lua examples for Packer, and I have seen no other discussion after a cursory issue search.

I have tried the following, changing do and for into ['do'] and ['for'] respectively since both are keywords in Lua, but the same error still surfaces. I suspect the -> operator might need special handling.

Plug 'iamcco/markdown-preview.nvim', { ['do'] = { -> 'mkdp#util#install()' }, ['for'] = {'markdown', 'vim-plug'}}

Any help is appreciated!

kunring commented 4 months ago
Plug("iamcco/markdown-preview.nvim", { ["do"] = vim.fn["mkdp#util#install"], ["for"] = { "markdown", "vim-plug" } })