Nik Kantar

Friday, July 29, 2016

Introducing GHT.vim

I wrote a Vim plugin to help with GitHub's issue and pull request templates.

A few months ago GitHub added support for issue and pull request templates. I’ve been encountering them more and more often, and have been copy/pasting the text from either GitHub or the files in the repository into a new Vim buffer, editing everything there, and copy/pasting back into GitHub before dealing with labels, milestones, and assignees.

As you can probably imagine, this feels a bit clumsy.

Since much of the time I already have Vim open in the given repository, I thought it would be neat if I could run a simple command to open up a new buffer with the contents of the given template.

And that’s precisely what GHT.vim provides. You get two commands, :GHTIssue and :GHTPR and they do basically what you’d expect, which is look for the appropriate template up your current working tree (by finding the directory that contains .git/config and then looking for .github/ISSUE_TEMPLATE.md or .github/PULL_REQUEST_TEMPLATE.md in it), open a new scratch buffer, and paste the contents into it. You then do the editing, copy/pasting into GitHub, and closing the buffer.

GHT.vim

That’s it.