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

Settings Loaded Through Packer Not Working

Open JBlocklove opened this issue 3 years ago • 1 comments
trafficstars

I have this plugin installed through packer.nvim and it seems to be working fine, except the configuration settings don't seem to work correctly. I have it set to auto start, but it doesn't. To test this a bit further I also changed it to not auto close and the preview auto closes anyway. I checked the value of those variables in a markdown file where it should have been correctly loaded and the values seem to be correct.

Here is how I have it loaded in packer:

use {
	'iamcco/markdown-preview.nvim',
    	run = function() vim.fn["mkdp#util#install"]() end,
    	ft = 'markdown',
	config = function() require('markdown').setup() end,
	opt=true
}

And the associated markdown.lua file that it pulls settings from:

local M = {}

M.setup = function()
	vim.g.mkdp_auto_start = 1
        vim.g.mkdp_auto_start = 0
end

return M

Any help would be greatly appreciated!

JBlocklove avatar Sep 09 '22 19:09 JBlocklove

I'm experiencing the same thing. As a workaround, my config looks something like this (summarized for brevity):

init.lua:

require('plugins') -- Let Packer do its thing
require('config_hacks') -- deal with non-cooperating plugins

config_hacks.lua:

-- Markdown Preview config is broken when using Packer's config hook.
-- See: https://github.com/iamcco/markdown-preview.nvim/issues/501
vim.g.mkdp_port = '8800'
vim.g.mkdp_page_title = '${name} - md.nvim'

This should at least unblock you for now. :)

gplusplus314 avatar Nov 20 '22 20:11 gplusplus314