Minor Update to Vim Gist Plugin for New GitHub API

MacVim.jpg

Today I was trying to use the Gist Vim plugin and noticed that it was a bit broken. In fact, it wasn't even close to working. I was getting HTML redirection messages, and that's not good. So I decided to take a few minutes and see if I could get it back working again. I looked at the site and noticed that it hadn't been updated recently, so it was going to be up to me.

What I figured was that it was in the URL for getting the Gist from GitHub. That's in this code:

  1. function! s:GistGet(user, token, gistid, clipboard)
  2. let url = 'https://gist.github.com/'.a:gistid.'.txt'
  3. let winnum = bufwinnr(bufnr('gist:'.a:gistid))

and after a bit of time reading the GitHub API site, and fiddling around with the URL, I was able to see that the correct URL is really:

  1. function! s:GistGet(user, token, gistid, clipboard)
  2. let url = 'https://raw.github.com/gist/'.a:gistid
  3. let winnum = bufwinnr(bufnr('gist:'.a:gistid))

So I changed that in my copies, and I'm good to go. For a while.