Cover image for Generating a Github Link Within Vim

Generating a Github Link Within Vim

jamescarr profile image James Carr ・1 min read

I'm always on the hunt for ways to improve efficiency and reduce the amount of mouse movements and clicks I have to do. One task I find can come up from time to time is grabbing a link from github to a specific line or section of code to either share in a ticket or ask a question about. I despise going to github for this so took a quick look to generate these quickly.

A quick search brought up knsh14/vim-github-link which seemed to do exactly what I needed. This plugin adds three useful commands:

  • GetCommitLink: commit which most recently modified the current file (permalink)
  • GetCurrentBranchLink: active branch name
  • GetCurrentCommitLink: most recent commit - URL will 404 if you haven't pushed it to the remote

What is really nice is that it copies the link in my clipboard, so I can just run :GetCommitLink (or map it to a shortcut key) and paste directly wherever I need to share it!

Posted on by:

jamescarr profile

James Carr


Father, Buddhist, Hacker.


Editor guide