Accessing a Jira ticket from Vim

Written by Michael Anckaert - Published on - Posted in Vim

Time to make some Quality of Life improvements to my Vim usage! I very often deal with Jira - the worlds most used and most hated issue tracker. As most of my workflow is done in Vim, I often have a ticket key in a Vim buffer and need to access the ticket. This normally involves copy-pasting the ticket number in the Jira interface. Repetitive, boring work!

What I really needed was a quick way to open the Jira ticket straight from Vim. So let's add a custom command to Vim to do just that!

Note: I'm quite new to Vim Script but thanks to Steve Losh's excellent Learn Vimscript the Hard Way I was able to get up and running quite quickly!

function Jira()
        echo "Calling Jira function"
        let wordUnderCursor = expand("<cWORD>")
        let l:site = "" . wordUnderCursor
        call netrw#BrowseX(l:site, netrw#CheckIfRemote())
command Jira call Jira()