gvim Windows 7 netrw open url under text cursor

浪尽此生 提交于 2019-12-25 06:44:01

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!