vim-markdown-composer icon indicating copy to clipboard operation
vim-markdown-composer copied to clipboard

window.close() on BufDelete

Open Yamakaky opened this issue 8 years ago • 6 comments

Did you consider closing the preview window on BufDelete? When I open multiple markdown files, I end up with a lot of tabs in my browser ^^ https://developer.mozilla.org/en-US/docs/Web/API/Window/close

Yamakaky avatar Mar 03 '16 14:03 Yamakaky

Sounds like a good idea.

euclio avatar Mar 14 '16 14:03 euclio

As of now, the preview window is tied to the current buffer. Is the use case here that you want each preview to correspond to a single buffer? Doable, but it will require a significant refactor.

euclio avatar Apr 04 '16 15:04 euclio

This might not be your use case, but I got to this thread by googling about how to automatic close the opened browser window after the edit session is closed, so it could be helpful to others:

I happen to not using firefox, but epiphany, the "native" browser for gnome, which is lighter and more compact. I found that if do the following, the window would exit after vim is closed:

let g:markdown_composer_browser = "/usr/bin/epiphany -a --profile ~/.config"

However, it doesn't close on BufDelete

Jerry-Ma avatar May 14 '16 05:05 Jerry-Ma

cc @Yamakaky @Jerry-Ma

I'm thinking about tackling this issue this week. Here's the current semantics (and how I use the plugin):

  1. Open markdown buffer A (BufEnter).
  2. Server is started.
  3. Web browser is opened.
  4. Buffer A contents are sent to server and rendered.
  5. Markdown buffer B is opened, becoming the active buffer (BufEnter).
  6. Buffer B contents are sent to server and rendered in the same tab.
  7. Buffer B is closed, making Buffer A the current active buffer.
  8. Buffer A contents are sent to the server and rendered.
  9. Vim is closed, closing the websocket connection. On close, the tab is also closed automatically.

@Yamakaky, I'm wondering how you end up with a lot of tabs when opening multiple markdown files? I'm happy to support your use case, just not sure exactly what it is 😄

euclio avatar May 17 '16 13:05 euclio

hello, curious if there's been any progress on this? it would be super handy!

alice-sawatzky avatar Sep 22 '17 19:09 alice-sawatzky

I haven't worked on this, no, but I think it would be a great feature.

euclio avatar Sep 22 '17 19:09 euclio