vermiculus / magithub

**DEPRECATED - please use Forge instead!** -- Magit-based interfaces to GitHub
GNU General Public License v3.0
579 stars 63 forks source link

Browse to webpage matching file in current buffer #280

Open aspiers opened 6 years ago

aspiers commented 6 years ago

If I have a file from a GitHub repository already open in the current buffer, it's often useful to be able to grab a hyperlink to the equivalent view of that file in GitHub's web UI, e.g. in order to share it with someone else. So it would be great if magithub-browse-thing or some other similarly named function was available to open up that page in the browser. Forgive me if this is already possible but I looked and can't find it.

Of course, if the locally checked out version corresponds to some upstream branch then it would make sense for the URL being opened in the browser to point to that upstream branch. Obviously here there is room for ambiguity, because the upstream branch could be calculated from the remote currently set, or the pushRemote currently set. I'd suggest that pushRemote should take precedence over normal remote, if it's set.

This seems somewhat related to, but distinct from, #215 and #173.

vermiculus commented 6 years ago

I think magithub-browse-thing could do this, kinda. It will require some kind of minor mode that can work in all buffers (i.e., make magithub-mode-map an active keymap) and then a new function magithub-browse-file to do what we want.

aspiers commented 6 years ago

Yep, that sounds great!

dakra commented 6 years ago

@aspiers if you don't want to wait you can use browse-at-remote https://github.com/rmuslimov/browse-at-remote which has exactly this feature plus it works for gitlab/bitbucket as well and also in the log buffer for commits.

aspiers commented 6 years ago

@dakra Thanks! I'll give that a go if it take a while for magithub to gain this functionality.

vermiculus commented 6 years ago

@aspiers Yeah, it may take a week or two 👍 I'm also in the boat of 'impossibly busy' with a committed release project at work, so I've been pretty burnt lately. Let me know what you like about it and I'll think about those things in development!

(And, as always, PRs are always welcome.)

aspiers commented 6 years ago

Same here with the work release deadline! Good luck and thanks a lot again!

agzam commented 6 years ago

I will add my 2 cents here: Spacemacs employs this nice package https://github.com/sshaw/git-link and a few helper functions, for example this one does exactly what's being asked here: https://github.com/syl20bnr/spacemacs/blob/develop/layers/+source-control/git/funcs.el#L50