blob: 401fc58b121033d76425020325419fe34a686bf9 [file] [log] [blame]
Bram Moolenaar843ee412004-06-30 16:16:41 +00001" NetrwFileHandlers: contains various extension-based file handlers for
2" netrw's browser
3" Author: Charles E. Campbell, Jr.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00004" Date: Jul 02, 2004
5" Version: 2
Bram Moolenaar843ee412004-06-30 16:16:41 +00006" ---------------------------------------------------------------------
7
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00008" NetrwFileHandler_html: handles html when the user hits "x" when the
9" cursor is atop a *.html file
Bram Moolenaar843ee412004-06-30 16:16:41 +000010fun! NetrwFileHandler_html(webpage)
11" call Dfunc("NetrwFileHandler_html(".a:webpage.")")
12
13 let host= substitute(a:webpage,'^\w\+://\%(\w*@\)\=\(\w\+\)/.*$','\1','e')
14" call Decho("host<".host.">")
15
16 if host == hostname() || host == substitute(hostname(),'\..*$','','e')
17 let page= substitute(a:webpage,'^\w\+://\%(\w*@\)\=\(\w\+\)/','file://\1/'.expand("$HOME").'/','e')
18 else
19 let page= substitute(a:webpage,'^\w\+://\%(\w*@\)\=\(\w\+\)/','http://\1/','e')
20 endif
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +000021
22 if executable("mozilla")
Bram Moolenaar843ee412004-06-30 16:16:41 +000023" call Decho("executing !mozilla ".page)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +000024 exe "!mozilla ".page
25 elseif executable("netscape")
26" call Decho("executing !netscape ".page)
27 exe "!netscape ".page
28 endif
Bram Moolenaar843ee412004-06-30 16:16:41 +000029
30" call Dret("NetrwFileHandler_html")
31endfun
32
33" ---------------------------------------------------------------------