From 3551e50e670dfbc6ca91778f823037938843861c Mon Sep 17 00:00:00 2001 From: Zach Himsel Date: Mon, 18 Mar 2019 12:51:04 -0600 Subject: [PATCH 1/2] Don't assume Google Chrome is the default browser Without using '-a ', the 'open' command just uses the user's default browser. This may not be the case, and if it's not, it breaks the preview workflow when using 'g:vim_markdown_preview_browser="Google Chrome"'. --- plugin/vim-markdown-preview.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/vim-markdown-preview.vim b/plugin/vim-markdown-preview.vim index 082c69f..e5007cc 100644 --- a/plugin/vim-markdown-preview.vim +++ b/plugin/vim-markdown-preview.vim @@ -95,7 +95,7 @@ function! Vim_Markdown_Preview() if g:vim_markdown_preview_browser == "Google Chrome" let b:vmp_preview_in_browser = system('osascript "' . g:vmp_search_script . '"') if b:vmp_preview_in_browser == 1 - call system('open -g /tmp/vim-markdown-preview.html') + call system('open -a "' . g:vim_markdown_preview_browser . '" -g vim-markdown-preview.html') else call system('osascript "' . g:vmp_activate_script . '"') endif @@ -149,7 +149,7 @@ function! Vim_Markdown_Preview_Local() if g:vim_markdown_preview_browser == "Google Chrome" let b:vmp_preview_in_browser = system('osascript "' . g:vmp_search_script . '"') if b:vmp_preview_in_browser == 1 - call system('open -g vim-markdown-preview.html') + call system('open -a "' . g:vim_markdown_preview_browser . '" -g vim-markdown-preview.html') else call system('osascript "' . g:vmp_activate_script . '"') endif From 1f8a80427e7b21eda4e9515c5579ac4368dcfeb7 Mon Sep 17 00:00:00 2001 From: Zach Himsel Date: Mon, 18 Mar 2019 13:00:23 -0600 Subject: [PATCH 2/2] Fix broken preview.html path For Vim_Markdown_Preview(), the file is saved to `/tmp/`. Whoops! --- plugin/vim-markdown-preview.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/vim-markdown-preview.vim b/plugin/vim-markdown-preview.vim index e5007cc..0144926 100644 --- a/plugin/vim-markdown-preview.vim +++ b/plugin/vim-markdown-preview.vim @@ -95,7 +95,7 @@ function! Vim_Markdown_Preview() if g:vim_markdown_preview_browser == "Google Chrome" let b:vmp_preview_in_browser = system('osascript "' . g:vmp_search_script . '"') if b:vmp_preview_in_browser == 1 - call system('open -a "' . g:vim_markdown_preview_browser . '" -g vim-markdown-preview.html') + call system('open -a "' . g:vim_markdown_preview_browser . '" -g /tmp/vim-markdown-preview.html') else call system('osascript "' . g:vmp_activate_script . '"') endif