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

After I moved My setup to lazy markdown didnt work

Open AndreM222 opened this issue 2 years ago • 9 comments

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
  1. Move files from after/plugins to lua/andrem222/plugins
  2. Restart
  • Trying to fix problem
  1. Uninstall plugin
  2. Restart computer
  3. Reinstall
  4. Get stuck in the cmd and never finish installation
  • Trying another way to fix problem
  1. Delete folder of markdown
  2. Restart computer
  3. Get back to nvim for automatic reinstallation
  4. Get stuck in cmd and never finish installation

Expected behavior Be able to finish setup and work properly

Screenshots image

Desktop (please complete the following information):

  • OS: Windows

AndreM222 avatar Feb 23 '24 03:02 AndreM222

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?

kmoschcau avatar Feb 25 '24 12:02 kmoschcau

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.

AndreM222 avatar Feb 25 '24 14:02 AndreM222

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.

The first line of the file invokes powershell with the rest of the contents of the file and exits.

kunring avatar Mar 03 '24 01:03 kunring

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.

AndreM222 avatar Mar 07 '24 20:03 AndreM222

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.

rijulkap avatar Apr 02 '24 05:04 rijulkap

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.

teoshibin avatar Apr 24 '24 19:04 teoshibin

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.

domWalters avatar Jun 14 '24 20:06 domWalters

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.

yea, I got it working the same way, will investigate further when I get some time.

arnvgh avatar Jun 16 '24 15:06 arnvgh

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

syz51 avatar Apr 02 '25 14:04 syz51