Thursday, October 18, 2012

Re: Exec Web Browser

Hi,
Instead of "!start SOMETHING" you could try simply "!start %". This way Windows will use your default browser.
Not tested.

Em 17/10/2012 20:59, "Gary Johnson" <garyjohn@spocom.com> escreveu:
On 2012-10-18, Sayth Renshaw wrote:
> Hi
>
> I have been looking for a way to send a html file to browser to review
> it. There is a lot of attempts, there is one here on stackoverflow
> http://stackoverflow.com/questions/8708154/open-current-file-in-web-browser-in-vim
>
> Which uses
> nmap <silent> <leader>w :exec 'silent !google-chrome % &'
>
> But apparently that isn't working according to responses. I am on
> windows and vim.
>
> Is there a way to adapt this or is there a better solution or plugin?

On Windows, the following worked to send a file to Firefox.

    :!start "C:\Program Files\Mozilla Firefox\firefox.exe" %

The following mapping also worked.

    nmap <silent> <leader>w :silent !start "C:\Program Files\Mozilla Firefox\firefox.exe" %<CR>

Beware of responses on stackoverflow.  The quality varies from very
good to horrible.  The ":exec" is not needed in your example above.
Windows executables other than Windows utilities are typically not
found in PATH, so you usually need to specify the full path name.

HTH,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: