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


"let $PATH = $PATH . ';c:\Programs\FireFox1.5'
" Evoke a web browser
function! Browser ()
  let line0 = getline (".")
  let line = matchstr (line0, "http[^ ]*")
  :if line==""
  let line = matchstr (line0, "ftp[^ ]*")
  :endif
  :if line==""
  let line = matchstr (line0, "file[^ ]*")
  :endif
  let line = escape (line, "#?&;|%")
  ":if line==""
  " let line = "\"" . (expand("%:p")) . "\""
  ":endif
  exec ':silent !firefox ' . "\"" . line . "\""
endfunction
map ,w :call Browser ()<CR>

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

Reply via email to