iamcco / markdown-preview.nvim

markdown preview plugin for (neo)vim
MIT License
6.82k stars 284 forks source link

MarkdownPreview opens two browsers when using a custom browser on macOS #675

Closed martin-braun closed 5 months ago

martin-braun commented 5 months ago

Describe the bug My default browser is Arc, but I want the preview to open in Safari, so I do:

vim.g.mkdp_browser = "/Applications/Safari.app"

within the init function of Lazy.nvim. It does work, but now my default browser AND safari open when I run MarkdownPreview.

To Reproduce

local M = { "iamcco/markdown-preview.nvim" }

M.name = "markdown_preview_nvim"
M.lazy = true
M.cond = true

M.init = function()
    vim.g.mkdp_filetypes = { "markdown" }
    vim.g.mkdp_auto_close = 0
    vim.g.mkdp_browser = "/Applications/Safari.app"
end

M.build = "cd app && yarn install"

M.ft = { "markdown" }

return M

Expected behavior It should open only Safari.

Desktop (please complete the following information):

Log:

mkdp: health#mkdp#check

- Platform: macos
- Nvim Version: NVIM v0.10.0
  Build type: Release
  LuaJIT 2.1.1716656478
  Run "nvim -V1 -v" for more info
- Node version: v20.14.0
- Script: /Users/marty/.local/share/nvim/lazy/markdown_preview_nvim/app/server.js
- Script exists: 1
- OK Using node

Additional comments

martin-braun commented 5 months ago

Ok, this is not an issue of this plugin as open -a Safari https://google.com would result in the same behavior. I found this: https://apple.stackexchange.com/questions/411625/opening-safari-with-url-from-terminal-also-opens-url-in-default-browser-chrome

Shortly after it's not happening anymore, I have no explanation for this. Weird.