- magit-remote-link.el — Actions with remote git hub links.
- Installation
- Usage
- Future stuff aka TODO
- License
This package provides functions for copying and opening URLs to specific lines in a Git repository on various hosting services.
This package requires magit
and project
and relies heavily on magit's ability to extract remote repository information from local Git repositories.
(use-package magit-remote-link
:ensure nil
:quelpa
(magit-remote-link :repo "pkulev/magit-remote-link.el"
:fetcher github :upgrade t)
:commands (magit-remote-link-copy-at-point magit-remote-link-browse-at-point)
:bind (("C-c m w" . magit-remote-link-copy-at-point)
("C-c m W" . magit-remote-link-browse-at-point)))
Once installed, you can use the following interactive commands (M-x
):
magit-remote-link-copy-at-point
: Copy the URL of the remote repository and the line at the point or in the active region to the clipboard.magit-remote-link-browse-at-point
: Open the URL of the remote repository and the line at the point or in the active region in a browser.
To use these functions, navigate to a file in a Git repository in magit and place the cursor on a line or select a region to specify the line number or range. Then use the key binding you configured or run the function directly to copy or open the URL. The URL will be copied or opened with the line number specified in the URL.
I have my magit stuff binded on the C-C m
prefix, and for these commands my mnemonics are: Copy a URL pointing to a line or a region in a file to the clipboard is more like kill-ring-save
(M-w
) function, so C-c m w
makes sense for me. Opening the same URL in Web browser is C-c m W
because of W in the "Web", huh. Obviously m
stands for magit
.
- Unit tests! I can check all of this by hands.
- Other Git repository providers support. For now the URLs are generated only in compliance with Github scheme.
- Copy link to a repository remote (not a particular file).
- Build correct links for lightweight markups like .md, .rst and so on.
- Browse a repository remote (maybe
forge.el
can do this already?). - Run unit tests via GHA.
This package is distributed under the GNU General Public License, version 3 or later. See the file LICENSE for details.