DEV Community

Cover image for Generating a Github Link Within Vim
James Carr
James Carr

Posted on

Generating a Github Link Within Vim

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!

Top comments (0)