-
-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Browse file on remote #91
Comments
This will probably involve a new slot (or three) in
|
Yes, though I don't think that's urgent. I prefer viewing files in While I would probably not "browse" files much, I would still like
But those will just be class-allocated |
Oh, and feel free to add issues such as this one, but please add the Also if you do intend on something yourself, then assign it to yourself. Hm, you probably are not allowed to do that yet. Time to give you some permissions. |
I would like that :-) I'm normally very diligent about labeling issues I create (at least in my repositories). |
Any status on this one? Would be a really great feature! |
There is a package with the same name which does the same thing https://github.com/rmuslimov/browse-at-remote. |
Yeah I know. There are multiple, I am using git-link myself: https://github.com/sshaw/git-link It would just be nice to have it in forge/magit instead :) |
I created a snippet for this. I took inspiration for how
It requires |
@fredefox's implementation is cool but |
(magit-file-relative-name buffer-file-name) |
This feature would be really useful if you would like to send over a reference to a file or a highlighted couple of lines to somebody over chat or email. |
I suppose you could combine the snippet @tarsius shared with the snippet I wrote replacing |
(defun forge-browse-buffer-file ()
(interactive)
(kill-new
(let
((rev (magit-get-current-branch))
(repo (forge-get-repository 'stub))
(file (magit-file-relative-name buffer-file-name)))
(forge--format repo "https://%h/%o/%n/blob/%r/%f"
`((?r . ,rev) (?f . ,file)))))) |
Thanks @bezirg I could understand and combine the two solutions. Actually I am working on a PR to add this functionality with line handling as well. The solution is working so far but I am struggling with this issue. |
I've created at PR #317 |
This version extends @fredefox 's to use the revision hash, rather than the branch name (so that the link is permanent), and adds highlighting from the region if applicable. (Only tested on GitHub so far) (defun btv-forge-browse-buffer-file ()
(interactive)
(browse-url
(let
((rev (magit-rev-abbrev "HEAD"))
(repo (forge-get-repository 'stub))
(file (magit-file-relative-name buffer-file-name))
(highlight
(if
(use-region-p)
(let ((l1 (line-number-at-pos (region-beginning)))
(l2 (line-number-at-pos (- (region-end) 1))))
(format "#L%d-L%d" l1 l2))
""
)))
(forge--format repo "https://%h/%o/%n/blob/%r/%f%L"
`((?r . ,rev) (?f . ,file) (?L . ,highlight)))))) |
That's a very nice addition. It's nice to see people share their creativity. I would probably replace
|
Optionally with selected region highlighted.
vermiculus/magithub#400
The text was updated successfully, but these errors were encountered: