M README.md => README.md +13 -0
@@ 13,6 13,7 @@ Vim Markdown Preview
- [Browser](#browser)
- [Temp File](#temp)
- [Github Flavoured Markdown](#github)
+ - [Use xdg-open](#xdg)
- [Behind the Scenes](#behind-the-scenes)
Intro
@@ 137,6 138,18 @@ Example: Use GitHub flavoured markdown.
let vim_markdown_preview_github=1
```
+<a name='xdg'></a>
+### The `vim_markdown_preview_use_xdg_open` option
+
+If your system does not come with `see`, and you would like to use `xdg-open` to view your rendered html in the browser, set the following flag:
+
+Default: `0`
+
+Example: Use `xdg-open`.
+```vim
+let vim_markdown_preview_use_xdg_open=1
+```
+
Behind The Scenes
-----------------
M plugin/vim-markdown-preview.vim => plugin/vim-markdown-preview.vim +14 -2
@@ 19,6 19,10 @@ if !exists("g:vim_markdown_preview_github")
let g:vim_markdown_preview_github = 0
endif
+if !exists("g:vim_markdown_preview_use_xdg_open")
+ let g:vim_markdown_preview_use_xdg_open = 0
+endif
+
if !exists("g:vim_markdown_preview_hotkey")
let g:vim_markdown_preview_hotkey='<C-p>'
endif
@@ 49,7 53,11 @@ function! Vim_Markdown_Preview()
if OSNAME == 'unix'
let chrome_wid = system("xdotool search --name 'vim-markdown-preview.html - " . g:vim_markdown_preview_browser . "'")
if !chrome_wid
- call system('see /tmp/vim-markdown-preview.html &> /dev/null &')
+ if g:vim_markdown_preview_use_xdg_open == 1
+ call system('xdg-open /tmp/vim-markdown-preview.html &> /dev/null &')
+ else
+ call system('see /tmp/vim-markdown-preview.html &> /dev/null &')
+ endif
else
let curr_wid = system('xdotool getwindowfocus')
call system('xdotool windowmap ' . chrome_wid)
@@ 98,7 106,11 @@ function! Vim_Markdown_Preview_Local()
if OSNAME == 'unix'
let chrome_wid = system("xdotool search --name '". curr_file . ".html - " . g:vim_markdown_preview_browser . "'")
if !chrome_wid
- call system('see ' . curr_file . '.html &> /dev/null &')
+ if g:vim_markdown_preview_use_xdg_open == 1
+ call system('xdg-open /tmp/vim-markdown-preview.html &> /dev/null &')
+ else
+ call system('see /tmp/vim-markdown-preview.html &> /dev/null &')
+ endif
else
let curr_wid = system('xdotool getwindowfocus')
call system('xdotool windowmap ' . chrome_wid)