@@ 5,8 5,29 @@
let g:vmp_script_path = resolve(expand('<sfile>:p:h'))
+let g:vmp_osname = 'Unidentified'
+
+if has('win32') || has('win64')
+ " Not yet used
+ let g:vmp_osname = 'win32'
+elseif has('unix')
+ let s:uname = system("uname")
+
+ if has('mac') || has('macunix') || has("gui_macvim") || s:uname == "Darwin\n"
+ let g:vmp_osname = 'mac'
+ let g:vmp_search_script = g:vmp_script_path . '/applescript/search-for-vmp.scpt'
+ let g:vmp_activate_script = g:vmp_script_path . '/applescript/activate-vmp.scpt'
+ else
+ let g:vmp_osname = 'unix'
+ endif
+endif
+
if !exists("g:vim_markdown_preview_browser")
- let g:vim_markdown_preview_browser = 'Google Chrome'
+ if g:vmp_osname == 'mac'
+ let g:vim_markdown_preview_browser = 'Safari'
+ else
+ let g:vim_markdown_preview_browser = 'Google Chrome'
+ endif
endif
if !exists("g:vim_markdown_preview_temp_file")
@@ 33,26 54,6 @@ if !exists("g:vim_markdown_preview_hotkey")
let g:vim_markdown_preview_hotkey='<C-p>'
endif
-
-let g:vmp_osname = 'Unidentified'
-
-if has('win32') || has('win64')
- " Not yet used
- let g:vmp_osname = 'win32'
-elseif has('unix')
- let s:uname = system("uname")
-
- if has('mac') || has('macunix') || has("gui_macvim") || s:uname == "Darwin\n"
- let g:vmp_osname = 'mac'
- let g:vmp_search_script = g:vmp_script_path . '/applescript/search-for-vmp.scpt'
- let g:vmp_activate_script = g:vmp_script_path . '/applescript/activate-vmp.scpt'
- else
- let g:vmp_osname = 'unix'
- endif
-endif
-
-
-
function! Vim_Markdown_Preview()
let b:curr_file = expand('%:p')
@@ 90,7 91,7 @@ function! Vim_Markdown_Preview()
call system('osascript "' . g:vmp_activate_script . '"')
endif
else
- call system('open -g /tmp/vim-markdown-preview.html')
+ call system('open -a "' . g:vim_markdown_preview_browser . '" -g /tmp/vim-markdown-preview.html')
endif
endif
@@ 139,7 140,7 @@ function! Vim_Markdown_Preview_Local()
call system('osascript "' . g:vmp_activate_script . '"')
endif
else
- call system('open -g vim-markdown-preview.html')
+ call system('open -a "' . g:vim_markdown_preview_browser . '" -g vim-markdown-preview.html')
endif
endif