如何从Vim在我的Web浏览器中打开http:// localhost?

ale*_*nco 10 vim localhost

基本上,我想告诉Vim:

  1. 打开我的网络浏览器(例如,Firefox)
  2. 在这个地址中打开这个文件(比如index.php):http:// localhost
  3. 换句话说:http://localhost/index.php

PS:不幸的是我使用的是Windows XP

Red*_*ing 10

如果你在Windows上运行Vim,那么这将工作:

:! start http://localhost/index.php
Run Code Online (Sandbox Code Playgroud)

这将使用默认浏览器,如果您想启动特定浏览器,则需要显式路径指向可执行文件(而不是启动).

从Vim help cmd:

:!{cmd},在

使用shell执行{cmd}.另请参阅'shell'和'shelltype'选项.

显然,如果你在其他系统上,你只需要使用appopriate命令在该平台上启动浏览器.

  • 谢谢它工作:启动"http://localhost/index.php""file:///"%:p"(在localhost中打开我当前的文件) (3认同)

Pet*_*ter 7

在mac上你可以

:!open http://localhost/index.php
Run Code Online (Sandbox Code Playgroud)