mattr555/vim-instacode — pull request #2 by AndrewRadev (2014-09-11 19:31:21+00:00)
Title: Remove need for python, simplify range functionality

This rewrites a bunch of stuff in order not to use python. It also removes the need to get the visual selection.

For the first part, url encoding is easily implementable in Vim. Apparently. I'll be honest, I'm not entirely sure why the `s:url_encode` function works, but it seems to work quite well.

The other reason to use python, though, is the cross-platform `webbrowser.open`. Vim has nothing like that, though a simple replacement is easy to whip up, as you can see in the `s:open_url` function. Sadly, this doesn't work on windows, since I don't know how to open urls on Windows. I'm sure there's an easy way using the "start" command, I just don't know it. I'm also not sure how robust relying on `xdg-open` is, but I'm thinking it would be quite easy to add replacements, like `gnome-open` or whatever if people complain.

These are still drawbacks, but the benefit is that you don't need to `sleep 500m`, and you don't get weird messages due to python stdout.

As for the visual selection, I've removed the need for it, since `-range=%` provides the ability to take the start and end lines of the selection, defaulting to the start and end lines of the entire buffer. It seems *very* unlikely to me that someone would actually like to share only half of the first line of a piece of code and/or half of the last one. If nothing else, it might mess with indentation. Seems reasonable to assume that people would like to share a set of lines, and not a random selection.

Given that this pull request improves some things and makes some things worse, I would definitely understand if you reject it. Or, if you want, I could implement only those changes you'd rather have.