Fail to open URL with dot at the end #4

Closed
wikimatze opened this Issue Oct 16, 2011 · 4 comments

Comments

Projects
None yet
2 participants

Hi there,

if I try to open https://github.com/vim-scripts/SuperTab-continued. with pressing it will fire up the browser with the URL https://github.com/vim-scripts/SuperTab-continued - so it doesn't parse the dot at the end of the file.

Owner

xolox commented Oct 17, 2011

This is by design: 9 out of a 10 times I would want the plug-in to ignore the trailing dot, so it does. In fact it explicitly ignores all trailing punctuation. The underlying problem is that detecting the end of a URL is quite hard, there is no explicit delimiter and because URLs are embedded in human readable text they're frequently followed by unrelated punctuation. I could make an option that controls this behavior:

  • When the option is disabled (by default) the plug-in will try to be smart about matching URLs (current behavior)
  • When the option is enabled by the user, the plug-in will just take the WORD under the text cursor without second guessing the user

However instead of introducing this configuration option I would rather have the plug-in work for everyone out of the box. Unfortunately I'm pretty much sure this is impossible without performing a HEAD request to see which of the two URLs (with and without trailing dot) is valid :-P. One other possibility is to introduce another key binding, for example <Control-F6> to follow the URL in the WORD under the text cursor.

Since you opened the case, do you have a preference for any of the above options? Or maybe you have other suggestions?

I would prefer the HEAD solution because there are so many other still cool vim shortcuts out there that doesn't fit in my brain without sufficient training. What is your estimation about the effort you have to put into this feature?

Owner

xolox commented Oct 28, 2011

Hi Matthias,

I've just published a new release of the vim-shell plug-in that includes a bit of Python to disambiguate URLs with trailing punctuation. I've tried it out on the URL you gave and it does the right thing now. I hope your Vim was compiled with Python support; I forgot to mention previously that Vim script doesn't support network sockets so the "HEAD solution" requires another programming language to check URLs for validity. To enable this feature you have to set the new g:shell_verify_urls option to 1 in your vimrc script. I hope this resolves your issue!

  • Peter

Works like a charm, I highly appreciate your great work you put in this plugin.

@wikimatze wikimatze closed this Oct 29, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment