Vim :Gbrowse support for Pagure
When you go to this directory, there is this file. Open it and see a function foo definition. In it, there is an incorrect condition. It is at line 123.
As software developers and sysadmins, we tend to communicate with other people much more than we could have ever imagined (when choosing this career path mainly as a way to escape the society). Particularly, we discuss semi-real, self-invented computer problems that supposedly need to be solved and that involves mentioning some existing pieces of code.
Let’s imagine your colleague asks where in the codebase is implemented some functionality. Unless you have an eidetic memory, you need to switch to your IDE and do a little of detective work to find out. Now, there is the boring part - explaining someone else what you are looking at. Only if there was a way for them to just see your editor. Instead, you are left with only two options, one more dull than the other.
- You can explain in which file it is, on what line(s), and describe approximately how it looks like.
- You can go to the site, where your codebase is hosted, navigate to the file/line(s) by yourself and send a link to it.
Thank god (or rather notorious Mr. Tim Pope) for vim-fugitive! Besides many great features,
it provides a
:Gbrowse command which opens the current file, line or visual selection in your web browser.
The support for various hosting sites is implemented in separate plugins, which are currently available for
GitHub, GitLab, Bitbucket, Gitee and now also even for Pagure!
While working with your code in vim, you can (select one or more lines and) type
Hit enter and it opens in your browser.
Please see these animated gifs for all the use-cases.
Plugin 'tpope/vim-fugitive' Plugin 'FrostyX/vim-fugitive-pagure'
Alternatively, you can install the
vim-fugitive-pagure RPM package available through
frostyx/vim-fugitive-pagure Copr repository. I will try to get it into official Fedora repositories soon!
Let me know what do you think.