markdown-preview.nvim icon indicating copy to clipboard operation
markdown-preview.nvim copied to clipboard

Convert vim-plug installation to Lua

Open jianyuchenxyz opened this issue 1 year ago • 1 comments

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!

jianyuchenxyz avatar Feb 17 '24 05:02 jianyuchenxyz

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

kunring avatar Feb 25 '24 07:02 kunring