11
|
1 " NetrwFileHandlers: contains various extension-based file handlers for
|
15
|
2 " netrw's browsers' x command
|
11
|
3 " Author: Charles E. Campbell, Jr.
|
15
|
4 " Date: Jul 06, 2004
|
|
5 " Version: 3
|
11
|
6 " ---------------------------------------------------------------------
|
|
7
|
12
|
8 " NetrwFileHandler_html: handles html when the user hits "x" when the
|
|
9 " cursor is atop a *.html file
|
15
|
10 fun! NetrwFileHandler_html(pagefile)
|
|
11 " call Dfunc("NetrwFileHandler_html(".a:pagefile.")")
|
|
12
|
|
13 let page= substitute(a:pagefile,'^','file://','')
|
11
|
14
|
15
|
15 if executable("mozilla")
|
|
16 " call Decho("executing !mozilla ".page)
|
|
17 exe "!mozilla ".page
|
|
18 elseif executable("netscape")
|
|
19 " call Decho("executing !netscape ".page)
|
|
20 exe "!netscape ".page
|
11
|
21 else
|
15
|
22 " call Dret("NetrwFileHandler_html 0")
|
|
23 return 0
|
11
|
24 endif
|
12
|
25
|
15
|
26 " call Dret("NetrwFileHandler_html 1")
|
|
27 return 1
|
|
28 endfun
|
|
29
|
|
30 " ---------------------------------------------------------------------
|
|
31 " NetrwFileHandler_htm: handles html when the user hits "x" when the
|
|
32 " cursor is atop a *.htm file
|
|
33 fun! NetrwFileHandler_htm(pagefile)
|
|
34 " call Dfunc("NetrwFileHandler_htm(".a:pagefile.")")
|
|
35
|
|
36 let page= substitute(a:pagefile,'^','file://','')
|
|
37
|
12
|
38 if executable("mozilla")
|
15
|
39 " call Decho("executing !mozilla ".page)
|
12
|
40 exe "!mozilla ".page
|
|
41 elseif executable("netscape")
|
15
|
42 " call Decho("executing !netscape ".page)
|
12
|
43 exe "!netscape ".page
|
15
|
44 else
|
|
45 " call Dret("NetrwFileHandler_htm 0")
|
|
46 return 0
|
12
|
47 endif
|
11
|
48
|
15
|
49 " call Dret("NetrwFileHandler_htm 1")
|
|
50 return 1
|
11
|
51 endfun
|
|
52
|
|
53 " ---------------------------------------------------------------------
|
15
|
54 " NetrwFileHandler_jpg:
|
|
55 fun! NetrwFileHandler_jpg(jpgfile)
|
|
56 " call Dfunc("NetrwFileHandler_jpg(jpgfile<".a:jpgfile.">)")
|
|
57
|
|
58 if executable("gimp")
|
|
59 exe "silent! !gimp -s ".a:jpgfile
|
|
60 elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE")
|
|
61 exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".a:jpgfile
|
|
62 else
|
|
63 " call Dret("NetrwFileHandler_jpg 0")
|
|
64 return 0
|
|
65 endif
|
|
66
|
|
67 " call Dret("NetrwFileHandler_jpg 1")
|
|
68 return 1
|
|
69 endfun
|
|
70
|
|
71 " ---------------------------------------------------------------------
|
|
72 " NetrwFileHandler_gif:
|
|
73 fun! NetrwFileHandler_gif(giffile)
|
|
74 " call Dfunc("NetrwFileHandler_gif(giffile<".a:giffile.">)")
|
|
75
|
|
76 if executable("gimp")
|
|
77 exe "silent! !gimp -s ".a:giffile
|
|
78 elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE")
|
|
79 exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".a:giffile
|
|
80 else
|
|
81 " call Dret("NetrwFileHandler_gif 0")
|
|
82 return 0
|
|
83 endif
|
|
84
|
|
85 " call Dret("NetrwFileHandler_gif 1")
|
|
86 return 1
|
|
87 endfun
|
|
88
|
|
89 " ---------------------------------------------------------------------
|
|
90 " NetrwFileHandler_pnm:
|
|
91 fun! NetrwFileHandler_pnm(pnmfile)
|
|
92 " call Dfunc("NetrwFileHandler_pnm(pnmfile<".a:pnmfile.">)")
|
|
93
|
|
94 if executable("gimp")
|
|
95 exe "silent! !gimp -s ".a:pnmfile
|
|
96 elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE")
|
|
97 exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".a:pnmfile
|
|
98 else
|
|
99 " call Dret("NetrwFileHandler_pnm 0")
|
|
100 return 0
|
|
101 endif
|
|
102
|
|
103 " call Dret("NetrwFileHandler_pnm 1")
|
|
104 return 1
|
|
105 endfun
|
|
106
|
|
107 " ---------------------------------------------------------------------
|
|
108 " NetrwFileHandler_bmp:
|
|
109 fun! NetrwFileHandler_bmp(bmpfile)
|
|
110 " call Dfunc("NetrwFileHandler_bmp(bmpfile<".a:bmpfile.">)")
|
|
111
|
|
112 if executable("gimp")
|
|
113 exe "silent! !gimp -s ".a:bmpfile
|
|
114 elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE")
|
|
115 exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".a:bmpfile
|
|
116 else
|
|
117 " call Dret("NetrwFileHandler_bmp 0")
|
|
118 return 0
|
|
119 endif
|
|
120
|
|
121 " call Dret("NetrwFileHandler_bmp 1")
|
|
122 return 1
|
|
123 endfun
|
|
124
|
|
125 " ---------------------------------------------------------------------
|