jesseduffield / lazygit

simple terminal UI for git commands
MIT License
53.44k stars 1.86k forks source link

Is there an equivalant of Fugitive's `:GBrowse`? #2923

Open jsatk opened 1 year ago

jsatk commented 1 year ago

One of the most useful things in tpope's Fugitive is :Gbrowse. I work on a team and am often sending over the exact code snippet I'm talking about. I'll visually select some code. Run :GBrowse. Then copy & paste the URL that opens to a coworker. From the README.

:GBrowse to open the current file on the web front-end of your favorite hosting provider, with optional line range (try it in visual mode). Plugins are available for popular providers such as GitHub, GitLab, Bitbucket, Gitee, Pagure, Phabricator, Azure DevOps, and sourcehut.

Is there any way to accomplish this in LazyGit?

mark2185 commented 1 year ago

Unfortunately it's not possible to do it directly through lazygit, but I'm curious about the implementation.

This could be one of the options for Custom patch, but only if the patch consists of one file. :thinking:

It's not possible to refer to several files at once, right? I know it doesn't make sense for :GBrowse! given that it takes a continuous range of lines, but is it possible through e.g. github at all?

AzraelSec commented 1 year ago

I'm curious about how you'd expect to use it. Having that feature in fugitive makes sense to me because I see it as an editor "enhancement": you select part of a file (or the file itself) and ask your plug-in to look for the matching file on the remote upstream. I think it would not work that well on lazygit, because the interactions do not originate from files but from commits/branches. As an example, you can open a commit to see what changes it includes - that's because a commit is a first-class concept in git (and in lazygit, as a consequence). I love the GBrowse feature, but I believe it doesn't fit in the way lazygit works.