LunarVim
LunarVim copied to clipboard
Unable to define a function for a plugin
Problem description
I try to configure iamcco/markdown-preview.nvim plugin (https://github.com/iamcco/markdown-preview.nvim) which allows using a custom function to start the browser (see https://github.com/iamcco/markdown-preview.nvim#faq).
The corresponding nvim config looks like this:
function OpenMarkdownPreview (url)
execute "silent ! firefox --new-window " . a:url
endfunction
let g:mkdp_browserfunc = 'OpenMarkdownPreview'
My LunarVim adaption looks like this:
vim.fn.OpenMarkdownPreview = function(url)
vim.cmd("silent ! /Applications/Firefox.app/Contents/MacOS/firefox --new-window " .. url)
end
vim.g.mkdp_browserfunc = "OpenMarkdownPreview"
which is not working, because the plugin is unable to find the function. How can I convert the nvim config correctly?
LunarVim version
rolling-5d964c5
Neovim version (>= 0.7)
NVIM v0.7.0
Operating system/version
macOS 12.3.1
Steps to reproduce
- Install the markdown-preview plugin https://github.com/iamcco/markdown-preview.nvim
- Try to configure a specific function used within the plugin
support info
Unused here
Screenshots
No response
Why are you dont read documentation?
https://www.lunarvim.org/plugins/02-extra-plugins.html#markdown-preview-nvim
Why are you dont read documentation?
https://www.lunarvim.org/plugins/02-extra-plugins.html#markdown-preview-nvim
Okay maybe I'm missing something out here, but the documentation doesn't say anything about providing a specific function to the plugin using the global configuration variable, or does it?
you need to call these before setting up the plugin, it's the downside of using vim globals as a configuration.
you can do this with packer if you replace the config
call with setup
.
please open a PR to fix the docs :smile:
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.