2009/8/4 David <[email protected]>:
>
> Hello,
>
> under Ubuntu and Vim 7.2, the following cript
>
> (from
> http://vim.wikia.com/wiki/Open_a_web-browser_with_the_URL_in_the_current_line)
>  has issues with certain URLs. If I try to open, for example,
> http://www.vim.org/scripts/script.php?script_id=974, the script adds an
> extra \ between php and ?, yielding an error message from the server as
> it can't find the correct page.
> The trouble lies in this line:
> exec ':silent !firefox ' . "\"" . line . "\""
>
> If I converted {"\"" . line . "\""} into just
> { . line}
> the script works, but is no longer protected by quotes.
>
> I realize that there also is this line:
> let line = escape (line, "#?&;|%")
> But what damage would be created by taking the ? out?
>
> Could someone help me to figure out how to change the line so that the
> URL doesn't break while preserving the quotes' protection?
>
> Thanks!
>
> David

It seems to me that the escape line is unneccessary since the URL is
protected by quoting it in the exec line. Either you escape special
characters to prevent the shell from parsing it, or you enclose the
argument in quotes. If you enclose the URL in quotes, however, I guess
you need to escape any quotes in the URL by changing the escape line
to

let line = escape(line, '"')

// Andreas

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to