Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
gu-fan committed Mar 14, 2015
1 parent 7e442bf commit 78c1eb2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions autoload/riv/link.vim
Expand Up @@ -19,7 +19,9 @@ fun! riv#link#browse(link) "{{{
if link =~ s:p.link_mail
let link = 'mailto:' . link
endif
call s:sys(g:riv_web_browser." ". escape(link,'#%')." &")
" call s:sys(g:riv_web_browser." ". escape(link,'#%')." &")
echom link
call riv#util#open(link)
endfun "}}}
fun! s:cursor(row, col) "{{{
" Move to cursor with jumplist changed.
Expand Down Expand Up @@ -231,7 +233,8 @@ fun! riv#link#open(...) "{{{
call riv#file#edit(expand(mo.groups[4]))
else
" vim will expand the # and % , so escape it.
call riv#link#browse(mo.groups[4])
" XXX: the groups[4] will remove the http/https , so use entire
call riv#link#browse(mo.groups[0])
endif
else
if mo.groups[3] =~ s:p.link_mail
Expand Down Expand Up @@ -372,7 +375,7 @@ fun! riv#link#hi_hover() "{{{
endfun "}}}

if expand('<sfile>:p') == expand('%:p') "{{{
call doctest#start()
" call doctest#start()
endif "}}}
let &cpo = s:cpo_save
unlet s:cpo_save
10 changes: 5 additions & 5 deletions autoload/riv/publish.vim
Expand Up @@ -288,10 +288,10 @@ fun! s:single2(ft, file, browse) "{{{
exe 'sp ' out_file
elseif a:ft == "odt"
" call s:sys(g:riv_ft_browser . ' '. shellescape(out_file) . ' &')
call riv#util#browse(shellescape(out_file), g:riv_ft_browser)
call riv#util#open(shellescape(out_file))
else
" call s:sys(g:riv_web_browser . ' '. shellescape(out_file) . ' &')
call riv#util#browse(shellescape(out_file), g:riv_web_browser)
call riv#util#open(shellescape(out_file))
endif
endif
endfun "}}}
Expand Down Expand Up @@ -364,19 +364,19 @@ fun! riv#publish#2(ft, file, path, browse) "{{{
exe 'sp ' out_file
elseif a:ft == "odt"
" call s:sys(g:riv_ft_browser . ' '. out_file . ' &')
call riv#util#browse(out_file, g:riv_ft_browser)
call riv#util#open(out_file)
else
let escaped_path = substitute(out_file, ' ', '\\ ', 'g')
" call s:sys(g:riv_web_browser . ' '. escaped_path . ' &')
call riv#util#browse(escaped_path, g:riv_web_browser)
call riv#util#open(escaped_path)
endif
endif
endfun "}}}

fun! riv#publish#browse() "{{{
let path = riv#path#build_ft('html') . 'index.html'
" call s:sys(g:riv_web_browser . ' '. shellescape(path) . ' &')
call riv#util#browse(shellescape(path), g:riv_web_browser)
call riv#util#open(shellescape(path))
endfun "}}}
fun! riv#publish#open_path() "{{{
exe 'sp ' riv#path#build_path()
Expand Down

1 comment on commit 78c1eb2

@gu-fan
Copy link
Owner Author

@gu-fan gu-fan commented on 78c1eb2 Mar 14, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the util's open instead.

see if it's OK

Please sign in to comment.