From 5838d1d45091ecb18ea51fa51c66d9dc91a3ebb8 Mon Sep 17 00:00:00 2001 From: JamshedVesuna Date: Tue, 22 Mar 2016 21:25:43 -0700 Subject: [PATCH] Fix OS X Safari bug --- plugin/vim-markdown-preview.vim | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/plugin/vim-markdown-preview.vim b/plugin/vim-markdown-preview.vim index a6c3ed7..3c1a1aa 100644 --- a/plugin/vim-markdown-preview.vim +++ b/plugin/vim-markdown-preview.vim @@ -74,11 +74,15 @@ function! Vim_Markdown_Preview() endif if g:vmp_osname == 'mac' - 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') + 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') + else + call system('osascript ' . g:vmp_activate_script) + endif else - call system('osascript ' . g:vmp_activate_script) + call system('open -g /tmp/vim-markdown-preview.html') endif endif @@ -117,11 +121,15 @@ function! Vim_Markdown_Preview_Local() endif if g:vmp_osname == 'mac' - 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') + 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') + else + call system('osascript ' . g:vmp_activate_script) + endif else - call system('osascript ' . g:vmp_activate_script) + call system('open -g vim-markdown-preview.html') endif endif -- 2.45.2