0
0
mirror of https://github.com/vim/vim.git synced 2025-07-24 10:45:12 -04:00
vim/runtime/plugin/NetrwFileHandlers.vim

34 lines
1.1 KiB
VimL
Raw Normal View History

2004-06-30 16:16:41 +00:00
" NetrwFileHandlers: contains various extension-based file handlers for
" netrw's browser
" Author: Charles E. Campbell, Jr.
2004-07-02 15:38:35 +00:00
" Date: Jul 02, 2004
" Version: 2
2004-06-30 16:16:41 +00:00
" ---------------------------------------------------------------------
2004-07-02 15:38:35 +00:00
" NetrwFileHandler_html: handles html when the user hits "x" when the
" cursor is atop a *.html file
2004-06-30 16:16:41 +00:00
fun! NetrwFileHandler_html(webpage)
" call Dfunc("NetrwFileHandler_html(".a:webpage.")")
let host= substitute(a:webpage,'^\w\+://\%(\w*@\)\=\(\w\+\)/.*$','\1','e')
" call Decho("host<".host.">")
if host == hostname() || host == substitute(hostname(),'\..*$','','e')
let page= substitute(a:webpage,'^\w\+://\%(\w*@\)\=\(\w\+\)/','file://\1/'.expand("$HOME").'/','e')
else
let page= substitute(a:webpage,'^\w\+://\%(\w*@\)\=\(\w\+\)/','http://\1/','e')
endif
2004-07-02 15:38:35 +00:00
if executable("mozilla")
2004-06-30 16:16:41 +00:00
" call Decho("executing !mozilla ".page)
2004-07-02 15:38:35 +00:00
exe "!mozilla ".page
elseif executable("netscape")
" call Decho("executing !netscape ".page)
exe "!netscape ".page
endif
2004-06-30 16:16:41 +00:00
" call Dret("NetrwFileHandler_html")
endfun
" ---------------------------------------------------------------------