diff --git a/NEWS b/NEWS index 6baaa87b..b8ac12bc 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,9 @@ * IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and VimperatorLeave respectively + * remove spaces and newlines when open urls starting with http:// or similar + before :o http://linux .com would search for http://linux and for .com, now + it just opens linux.com. Also handy when pasting broken urls with p or P. * add 'wildcase' option * 'linkbgcolor', 'linkfgcolor', ... have been replaced with highlight groups, HintElem and HintActive diff --git a/content/util.js b/content/util.js index cfcde112..e1bff7eb 100644 --- a/content/util.js +++ b/content/util.js @@ -470,6 +470,10 @@ const util = { //{{{ } catch (e) {} + // removes spaces from the string if it starts with http:// or something like that + if (/^\w+:\/\//.test(urls[url])) + urls[url] = urls[url].replace(/\s+/g, ""); + // strip each 'URL' - makes things simpler later on urls[url] = urls[url].replace(/^\s+/, "").replace(/\s+$/, "");