Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I open http://localhost in my web browser from Vim?

Tags:

vim

localhost

Basically, I want to tell Vim:

  1. Open my web browser (for instance, Firefox)
  2. Open this file (say index.php) in thought this address : http://localhost
  3. In other words: http://localhost/index.php

PS: Unfortunately I use Windows XP

like image 758
alexchenco Avatar asked Jan 11 '10 03:01

alexchenco


1 Answers

If you are running Vim on windows, then this will work:

:! start http://localhost/index.php

This will use the default browser, if you wanted to start a specific browser then you would need the explicit path to the executable (instead of start).

From the Vim help cmd:

:!{cmd}

Execute {cmd} with the shell. See also the 'shell' and 'shelltype' option.

Obviously, if you are on some other system you just need to use the appopriate command to start the browser on that platform.

like image 57
RedBlueThing Avatar answered Oct 20 '22 04:10

RedBlueThing