Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 1 | " NetrwFileHandlers: contains various extension-based file handlers for |
| 2 | " netrw's browser |
| 3 | " Author: Charles E. Campbell, Jr. |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame^] | 4 | " Date: Jul 02, 2004 |
| 5 | " Version: 2 |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 6 | " --------------------------------------------------------------------- |
| 7 | |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame^] | 8 | " NetrwFileHandler_html: handles html when the user hits "x" when the |
| 9 | " cursor is atop a *.html file |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 10 | fun! 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 Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame^] | 21 | |
| 22 | if executable("mozilla") |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 23 | " call Decho("executing !mozilla ".page) |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame^] | 24 | exe "!mozilla ".page |
| 25 | elseif executable("netscape") |
| 26 | " call Decho("executing !netscape ".page) |
| 27 | exe "!netscape ".page |
| 28 | endif |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 29 | |
| 30 | " call Dret("NetrwFileHandler_html") |
| 31 | endfun |
| 32 | |
| 33 | " --------------------------------------------------------------------- |