Code Monkey home page Code Monkey logo

Comments (7)

drmason13 avatar drmason13 commented on May 29, 2024 2

I don't know if Firefox used to not share a window name, but now it appears to:

$ firefox --version
Mozilla Firefox 62.0.3

$ xprop | grep 'WM_NAME(STRING)'
{Click on Firefox}
WM_NAME(STRING) = "vim-markdown-preview.html - Mozilla Firefox"

$ xdotool search --name 'vim-markdown-preview.html'
56623121

Changing the browser name option to Mozilla Firefox should make it work :)

let vim_markdown_preview_browser='Mozilla Firefox'

The name is important, as the plugin script searches for the full name of the browser in the window. If it was set to something like 'Firefox' then I don't think it would work.

The relevant plugin code is:

 if g:vmp_osname == 'unix'
    let chrome_wid = system("xdotool search --name vim-markdown-preview.html - " . g:vim_markdown_preview_browser . "'")
    if !chrome_wid
      if g:vim_markdown_preview_use_xdg_open == 1
        call system('xdg-open vim-markdown-preview.html 1>/dev/null 2>/dev/null &')
      else
        call system('see vim-markdown-preview.html 1>/dev/null 2>/dev/null &')
endif
    else
      let curr_wid = system('xdotool getwindowfocus')
      call system('xdotool windowmap ' . chrome_wid)
      call system('xdotool windowactivate ' . chrome_wid)
      call system("xdotool key 'ctrl+r'")
      call system('xdotool windowactivate ' . curr_wid)
    endif
endif

This makes it always open a new window if it can't find the window using xdotools search.

With the right value of name it will also swap the focus back to vim which is very nice.

from vim-markdown-preview.

phcerdan avatar phcerdan commented on May 29, 2024

Facing this as well.

from vim-markdown-preview.

jessebett avatar jessebett commented on May 29, 2024

I also have this bug.

from vim-markdown-preview.

mortang2410 avatar mortang2410 commented on May 29, 2024

That is because firefox does not report the filename in its window name, so xdotool can't search for it. For now, only chromium-browser and the like do report the filename. So you either change your xdg-open (if you use that setting), or the see browser. Or just be like me, fork and replace see with chromium-browser 😏

from vim-markdown-preview.

der-ali avatar der-ali commented on May 29, 2024

thanks @drmason13 ^^ It worked for me

from vim-markdown-preview.

amirulmenjeni avatar amirulmenjeni commented on May 29, 2024

Same here, using qutebrowser, opened with xdg-open.

My settings:

let vim_markdown_preview_use_xdg_open=1
let vim_markdown_preview_hotkey='<C-m>'
let vim_markdown_preview_toggle=2 " display on buffer write

from vim-markdown-preview.

DimiTech avatar DimiTech commented on May 29, 2024

I had the same issue as OP, and changing the browser name to 'Mozilla Firefox' made it so that the tab doesn't even open at all. I'm on MacOS 10.15.4, Grip 4.5.2.

from vim-markdown-preview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.