vim-markdown-composer
vim-markdown-composer copied to clipboard
window.close() on BufDelete
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
Sounds like a good idea.
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.
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
cc @Yamakaky @Jerry-Ma
I'm thinking about tackling this issue this week. Here's the current semantics (and how I use the plugin):
- Open markdown buffer A (
BufEnter
). - Server is started.
- Web browser is opened.
- Buffer A contents are sent to server and rendered.
- Markdown buffer B is opened, becoming the active buffer (
BufEnter
). - Buffer B contents are sent to server and rendered in the same tab.
- Buffer B is closed, making Buffer A the current active buffer.
- Buffer A contents are sent to the server and rendered.
- 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 😄
hello, curious if there's been any progress on this? it would be super handy!
I haven't worked on this, no, but I think it would be a great feature.