After I moved My setup to lazy markdown didnt work
Describe the bug After switching to lazy it was not working. I have tried reinstalling the plugin but it gets stuck in the terminal part. I also tried just waiting for some hours, but after waiting for 2 hours nothing happened.
To Reproduce -- Code --
-- Preview
{
"iamcco/markdown-preview.nvim", -- Preview Markdown
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = function() vim.fn["mkdp#util#install"]() end,
},
Steps to reproduce the behavior:
- Beginning of problem
- Move files from after/plugins to lua/andrem222/plugins
- Restart
- Trying to fix problem
- Uninstall plugin
- Restart computer
- Reinstall
- Get stuck in the cmd and never finish installation
- Trying another way to fix problem
- Delete folder of markdown
- Restart computer
- Get back to nvim for automatic reinstallation
- Get stuck in cmd and never finish installation
Expected behavior Be able to finish setup and work properly
Screenshots
Desktop (please complete the following information):
- OS: Windows
Might be part of the problem, this file seems highly sus: https://github.com/iamcco/markdown-preview.nvim/blob/master/app/install.cmd
.cmd usually contains cmd.exe commands (like in .bat files). But this file has Powershell commands in it. cmd.exe and Powershell are not compatible. If this script is supposed to run Powershell commands, it needs to have a .ps1 extension instead.
Could you try to rename that file in your local copy and also change this line to say install.ps1 instead?
Well, the thing is it did work before when I had some files in different folders. Now that I fully moved to lazy from my old packer setup it is not working anymore. I will try it out.
Might be part of the problem, this file seems highly sus: https://github.com/iamcco/markdown-preview.nvim/blob/master/app/install.cmd
.cmdusually containscmd.execommands (like in.batfiles). But this file has Powershell commands in it.cmd.exeand Powershell are not compatible. If this script is supposed to run Powershell commands, it needs to have a.ps1extension instead.
The first line of the file invokes powershell with the rest of the contents of the file and exits.
I still have the problem. is there any prerequisite for windows powershell? It does work if I use npm or yarn for this but I am trying to make my setup dependency free.
Seem to be having the same issue. The install fails as i use nvim on powershell (powershell 7.4.0 to be exact).
To bypass this i can navigate to the lazy install directory and run the markdown-preview/install.cmd using command prompt, following which the plugin works as intended. I would like to avoid doing this as i tend to run the same config on different machines and this seems to be a pretty awkward workaround.
Did some testing.
So I believe what actually happened is that since we set the default shell to be powershell, we have to specify the command like so .\install.cmd instead of install.cmd as the later will only work for cmd (otherwise you'll get the not found error) and the fix should work for both powershell and cmd.
I encountered this same issue on Arch Linux.
I hadn't used this plugin in a while, and realised it wasn't working a week or two ago (running :MarkdownPreview flashed the command bar and did nothing).
I manually ran install.sh in the app directory in the plugin, and now it's fine again.
I don't know what broke this.
I encountered this same issue on Arch Linux.
I hadn't used this plugin in a while, and realised it wasn't working a week or two ago (running
:MarkdownPreviewflashed the command bar and did nothing).I manually ran
install.shin theappdirectory in the plugin, and now it's fine again.I don't know what broke this.
yea, I got it working the same way, will investigate further when I get some time.
on windows, a temperory fix for this is similar to what @vimfn and @domWalters are saying. Go to the data directory where your plugin is installed, typically under: ~/.local/share/nvim/lazy or similar, go to the app directory of this plugin, and run the install.cmd file from outside of powershell. This will download the markdown-preview-win.exe file inside the app/bin/ directory, which will make the plugin work