tyru / open-browser.vim

Open URI with your favorite browser from your most favorite editor
http://www.vim.org/scripts/script.php?script_id=3133
Other
508 stars 48 forks source link

Only part of a full URL is opened #120

Open jdhao opened 5 years ago

jdhao commented 5 years ago

Hi, this is a great plugin which works both on Windows and Mac. I have found that for some URL, only part of the URL is opened in the browser. For example, for URL http://rrc.cvc.uab.es/?ch=2&com=tasks#WordRecognition, when I use this plugin to open it in the browser, only http://rrc.cvc.uab.es/?ch=2 is opened.

tyru commented 4 years ago

I couldn't reproduce this on macOS. If this problem still persists, please tell me

jdhao commented 4 years ago

@tyru This problem still persists. Version info:

Minimal step to reproduce:

set runtimepath=C:\Users\Administrator\AppData\Local\nvim-data\plugged\open-browser.vim,$VIMRUNTIME
nmap ob <Plug>(openbrowser-smart-search)
http://rrc.cvc.uab.es/?ch=2&com=tasks#WordRecognition
nvim -u init.vim test.md

Result: only http://rrc.cvc.uab.es/?ch=2 is opened in the browser.

BTW: my default browser is Chrome. I am not sure if this is relevant.

jdhao commented 4 years ago

It seems that it is a problem with Windows system, not related to this plugin. If we run the following following command directly from the command line:

chrome.exe http://rrc.cvc.uab.es/?ch=2&com=tasks#WordRecognition

The same issue occurs. According to here, & has special meanings on Windows. We have to quote the whole URL or use ^ to escape special characters. Both the following two commands works:

chrome.exe "http://rrc.cvc.uab.es/?ch=2&com=tasks#WordRecognition"
chrome.exe http://rrc.cvc.uab.es/?ch=2^&com=tasks#WordRecognition
tyru commented 4 years ago

Thanks for the info. I'll look into this.