https://github.com/sshaw/git-link.git
git clone 'git://github.com/sshaw/git-link.git'
Interactive Emacs functions that create URLs for files and commits in
GitHub/Bitbucket/Gitorious/GitLab/… repositories. git-link
returns the URL
for the current buffer's file location at the current line number or active
region. git-link-commit
returns the URL for a commit. URLs are added to the
kill ring.
M-x git-link
and M-x git-link-commit
With a prefix argument prompt for the remote's name. Defaults to "origin"
.
git-link-default-remote
Name of the remote branch to link to, defaults to "origin"
.
git-link-open-in-browser
If non-nil
also open link in browser via browse-url
, defaults to nil
.
git-link-use-commit
If non-nil
use the latest commit's hash in the link instead of the branch name, defaults to nil
.
git-link-remote-alist
and git-link-commit-remote-alist
map remotes'
hostnames to a function capable of creating a URL on that host. To add (or
modify) how URLs are created for a given host add the appropriate function
objects to this lists.
If you use a self-hosted version of one of the supported services, you
can configure the link function alists for the hostname at which that
service is hosted. For example, for a GitHub Enterprise instance at
github.example.com
, you could add the following to your .emacs
file.
(eval-after-load "git-link"
'(progn
(add-to-list 'git-link-remote-alist
'("github.example.com" git-link-github))
(add-to-list 'git-link-commit-remote-alist
'("github.example.com" git-link-commit-github))))
The git-link
signature is:
HOSTNAME DIRNAME FILENAME BRANCH COMMIT START END
HOSTNAME
hostname of the remoteDIRNAME
directory portion of the remoteFILENAME
source file, relative to DIRNAME
BRANCH
active branch, may be nil
if the repo's in “detached HEAD” stateCOMMIT
SHA of the latest commitSTART
starting line numberEND
ending line number, nil
unless region is activeThe git-link-commit
signature is:
HOSTNAME DIRNAME COMMIT
HOSTNAME
hostname of the remoteDIRNAME
directory portion of the remoteCOMMIT
SHA of the commitgit-link-*-alist
sgit-link-grep