All Projects → sshaw → Git Link

sshaw / Git Link

Emacs package to get the GitHub/Bitbucket/GitLab/... URL for a buffer location

Projects that are alternatives of or similar to Git Link

Emacs Gitlab
A Gitlab client for Emacs
Stars: ✭ 128 (-46.44%)
Mutual labels:  emacs, gitlab
Ac Php
emacs auto-complete & company-mode for php
Stars: ✭ 157 (-34.31%)
Mutual labels:  emacs, spacemacs
Gitmails
An information gathering tool to collect git commit emails in version control host services
Stars: ✭ 142 (-40.59%)
Mutual labels:  gitlab, bitbucket
Gitlink
A Jetbrains plugin that opens a local file under Git version control in its remote host using the default browser.
Stars: ✭ 101 (-57.74%)
Mutual labels:  gitlab, bitbucket
Env Ci
Get environment variables exposed by CI services
Stars: ✭ 180 (-24.69%)
Mutual labels:  gitlab, bitbucket
Srcery Emacs
Dark colorscheme for Emacs/Spacemacs. GUI and terminal support
Stars: ✭ 102 (-57.32%)
Mutual labels:  emacs, spacemacs
Browse At Remote
Browse target page on github/bitbucket from emacs buffers
Stars: ✭ 155 (-35.15%)
Mutual labels:  gitlab, bitbucket
Dumb Jump
an Emacs "jump to definition" package for 50+ languages
Stars: ✭ 1,256 (+425.52%)
Mutual labels:  emacs, spacemacs
Git Open
Type `git open` to open the GitHub page or website for a repository in your browser.
Stars: ✭ 2,694 (+1027.2%)
Mutual labels:  gitlab, bitbucket
Source Integration
Source control integration plugin framework for MantisBT, including support for Github, Gitlab, Bitbucket, Gitweb, Cgit, Subversion, Mercurial and more
Stars: ✭ 167 (-30.13%)
Mutual labels:  gitlab, bitbucket
Integram
Integrate Telegram into your workflow – Trello, Gitlab, Bitbucket and other bots
Stars: ✭ 1,365 (+471.13%)
Mutual labels:  gitlab, bitbucket
Cgx
💻🔥CLI to generate the recommended documentation/files to improve contribution (Github, Gitlab, CodeCommit and Bitbucket)
Stars: ✭ 190 (-20.5%)
Mutual labels:  gitlab, bitbucket
Gittar
🎸 Download and/or Extract git repositories (GitHub, GitLab, BitBucket). Cross-platform and Offline-first!
Stars: ✭ 87 (-63.6%)
Mutual labels:  gitlab, bitbucket
Android Ci
A docker image for building Android apps. Supports multiple SDK Build Tools.
Stars: ✭ 101 (-57.74%)
Mutual labels:  gitlab, bitbucket
Git History Browser Extension
Agrega un botón a la interfáz de archivos de github para ver su historial / Add a button to the github file interface to see its history
Stars: ✭ 87 (-63.6%)
Mutual labels:  gitlab, bitbucket
Contributions Importer For Github
This tool helps users to import contributions to GitHub from private git repositories, or from public repositories that are not hosted in GitHub.
Stars: ✭ 147 (-38.49%)
Mutual labels:  gitlab, bitbucket
Notes
Some public notes
Stars: ✭ 1,248 (+422.18%)
Mutual labels:  gitlab, bitbucket
Git Copy History
Copy commit history from another repository
Stars: ✭ 84 (-64.85%)
Mutual labels:  gitlab, bitbucket
Spacemacs Rocks
Happy Hacking Emacs & Spacemacs (Simplified Chinese)
Stars: ✭ 2,003 (+738.08%)
Mutual labels:  emacs, spacemacs
Grav Plugin Git Sync
Collaboratively Synchronize your Grav `user` folder hosted on GitHub, BitBucket or GitLab
Stars: ✭ 183 (-23.43%)
Mutual labels:  gitlab, bitbucket

git-link

MELPA Build Status

Interactive Emacs functions that create URLs for files and commits in GitHub/Bitbucket/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 the commit at point.

git-link-homepage returns the URL for the repository's homepage.

URLs are added to the kill ring.

Usage

Functions can be called interactively (M-x git-link) or via a key binding of your choice. For example:

(global-set-key (kbd "C-c g l") 'git-link)

With a prefix argument prompt for the remote's name. Defaults to "origin".

With a prefix argument of -, generate a link without line numbers.

Works with Dired, Magit, VC revisions, and Tramp too.

Settings

Global setting are elisp variables. They can be set directly or via M-x customize.

Local settings are managed via the repository's git configuration. They can be set via:

git config --local --add setting value

Local settings have precedence over global settings.

Global

git-link-default-remote

Name of the remote to link to, defaults to nil.

git-link-default-branch

Name of the remote branch to link to, defaults to the current branch.

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-use-single-line-number

If nil line numbers are only added when the selection contains more than 1 line, defaults to t.

Note that git-link will exclude line numbers when invoked with the - prefix argument.

Local

git-link.remote

Name of the remote to link to.

git-link.branch

Name of the remote branch to link to.

Supported Services

Git Timemachine

If git-timemachine-mode is active git-link generates a URL for the version of the file being visited.

Sourcegraph

To link to files on a Sourcegraph server add a git remote pointing to the repository's Sourcegraph page:

git remote add sourcegraph https://sourcegraph.com/github.com/sshaw/copy-as-format

Links can be generated by specifying sourcegraph as your remote when calling the desired link function or by setting sourcegraph as the default remote.

Note that the remote can be named anything but its URL's host must match what's in the associated link function's alist. This defaults to "sourcegraph" but can be changed. See Building Links and Adding Services.

URLs with ports or an http scheme will not work. It's a trivial fix so if it's a problem for you please open an issue.

Building Links and Adding Services

git-link-remote-alist is an alist containing (REGEXP FUNCTION) elements. The FUNCTION creates URLs for file on remote host names that match the REGEXP. To add (or modify) how URLs are created for a given host, add appropriate elements to this list.

As an example, one of the default elements in this alist is ("gitlab" git-link-gitlab). So the git-link-gitlab function will be used to create URLs to files in remotes that match the regexp "gitlab". That would cover common Gitlab host URLs like "gitlab.com", "gitlab.example.com" and "gitlab.example.org".

git-link-commit-remote-alist is also an alist containing (REGEXP FUNCTION) elements. Here, the FUNCTION creates URLs to the commit pages, for remote hosts matching REGEXP.

If you use a self-hosted version of one of the supported services, but your remote URL does match with the defaults, you can configure these link function alists. For example, for a GitHub Enterprise instance at gh.example.com, you could add the following to your .emacs file:

(eval-after-load 'git-link
 '(progn
   (add-to-list 'git-link-remote-alist
     '("gh\\.example\\.com" git-link-github))
   (add-to-list 'git-link-commit-remote-alist
     '("gh\\.example\\.com" git-link-commit-github))))

The git-link signature is:

HOSTNAME DIRNAME FILENAME BRANCH COMMIT START END

  • HOSTNAME hostname of the remote
  • DIRNAME directory portion of the remote
  • FILENAME source file, relative to DIRNAME
  • BRANCH active branch, may be nil if the repo's in "detached HEAD" state
  • COMMIT SHA of the latest commit
  • START starting line number
  • END ending line number, nil unless region is active

The git-link-commit signature is:

HOSTNAME DIRNAME COMMIT

  • HOSTNAME hostname of the remote
  • DIRNAME directory portion of the remote
  • COMMIT SHA of the commit

See Also

TODO

  • More tests!
  • Consolidate git-link-*-alists
  • git-link-grep
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].