Compare commits

...

1 Commits

Author SHA1 Message Date
f65a068b4e don't auto reopen preview window #13 2017-02-07 16:32:27 +11:00
2 changed files with 6 additions and 3 deletions

View File

@ -71,12 +71,14 @@ class MarkdownLivePreviewListener(sublime_plugin.EventListener):
def on_activated_async(self, view): def on_activated_async(self, view):
vsettings = view.settings() vsettings = view.settings()
if (is_markdown_view(view) if (is_markdown_view(view) and get_settings().get(ON_OPEN)
and get_settings().get('markdown_live_preview_on_open')
and not vsettings.get(PREVIEW_ENABLED) and not vsettings.get(PREVIEW_ENABLED)
and vsettings.get('syntax') != 'Packages/MarkdownLivePreview/' + \ and vsettings.get('syntax') != 'Packages/MarkdownLivePreview/' + \
'.sublime/MarkdownLivePreviewSyntax' + \ '.sublime/MarkdownLivePreviewSyntax' + \
'.hidden-tmLanguage'): '.hidden-tmLanguage'
and not any(filter(lambda window: window.settings().get(PREVIEW_WINDOW) is True,
sublime.windows()))):
# print("MarkdownLivePreview.py:81", 'open window')
sublime.run_command('new_markdown_live_preview') sublime.run_command('new_markdown_live_preview')

View File

@ -6,3 +6,4 @@ IS_PREVIEW = 'is_markdown_live_preview'
IS_HIDDEN = 'is_hidden_markdown_live_preview' IS_HIDDEN = 'is_hidden_markdown_live_preview'
MD_VIEW_ID = 'markdown_live_preview_md_id' MD_VIEW_ID = 'markdown_live_preview_md_id'
PREVIEW_WINDOW = 'markdown_live_preview_window' PREVIEW_WINDOW = 'markdown_live_preview_window'
ON_OPEN = 'markdown_live_preview_on_open'