I'm using gvim 7.3, MS-Windows 32-bit GUI version with OLE support
I'm attempting to configure the netrw filehandler to open locally saved .html files in with the elinks browser, rather than the firefox browser. The help file for netrw refers to a setting that can be placed in the .vimrc file:
:let g:netrw_browsex_viewer= " "
it also says that
'for Windows 32 or 64 the url and FileProtocolHandler dlls are used'.
I've tried entering the filepath to the elinks executable between the quotes, but no result. My internet searches so far haven't revealed any practical examples of how to work with url and FileProtocolHandler dlls in vim.
I would be very grateful for any help.
GilF
g:netrw_browsex_viewer is for defining a generic program to open stuff with. So while it might work to point it to elinks for html files, it will break jpg/pdf/etc files. On Windows, it may be most appropriate to use 'start' which uses Window's file associations. Since that's not a real program, you can make a batch file:
Put that in c:\stuff\magicopen.bat and
let g:netrw_browsex_viewer = 'c:/stuff/magicopen.bat'
(The path doesn't matter, but the forward slashes do!)Alternatively, you can use netrw's netrw_filehandler:
Change the internals of NFH_html as needed (absolute path to elinks, invocation arguments, add more !start options -- see
:help !start
).This allows you to launch correct file viewer for all kinds of files: (powerpoint ppt, excel xls, chrome html, vlc on video) and whatever windows explorer has association for. On windows7, put the batch file expl2.cmd in your vim path.
In vimrc put
In gvim use gx on cfile to launch explorer.exe, it will launch correct viewer, e.g. powerpoint,firefox,chrome. Notes: The second line converts forward slashes to backslashes. If you have spaces in your filename, vim won't expand cfile.
c:> cat expl2.cmd
I also wrote this answer in gvim Windows 7 netrw open url under text cursor as it comes up first in google.
Are you trying to "edit" the html file (ie. :e somefile.html)?
Try putting
in your .vimrc