问题
I've added this line to my vimrc file in order to be able to open a link with the command 'gx':
let g:netrw_browsex_viewer = 'firefox'
Unfortunately the only thing that happens is that a tiny DOS window flashes on the screen.
Advice very welcome.
GilF
回答1:
On windows7, put the batch file expl2.cmd in your vim path.
In vimrc put
:let netrw_browsex_viewer='expl2.cmd'
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
set file=%1
set file=%file:/=\%
start explorer.exe /n,/e,/root,%file%
回答2:
I think firefox
is not exists in your PATH variable. To set it:
On the bottom of the Start menu type in env
, then select one of the elemets in the list to set up environment variables. (if you are an administrator then select the system variables, otherwise the other opinion) Search for the PATH variable, then double click on it to set it's value. Add the path of the firefox.exe
to the end of the string with a semicolon before it, for example: ;C:\Program Files\firefox\
It should work now.
来源:https://stackoverflow.com/questions/23316272/gvim-windows-7-netrw-open-url-under-text-cursor