stefanv / org-link-github

Shorthand github links for org-mode

Repository from Github https://github.comstefanv/org-link-githubRepository from Github https://github.comstefanv/org-link-github

org-link-github

Add GitHub links to org-mode (see External links).

Examples

gh:scikit-image/scikit-image#1000

Configuration

By customizing org-link-github-shortcuts, you can have even shorter URLs:

gh:skimage#1000

org-link-github-shortcuts should be an association list of shortcut-repo:

(setq org-link-github-shortcuts
     '(("skimage" . "scikit-image/scikit-image")
       ("numpy" . "numpy/numpy")))

Installation

(use-package org-link-github
  :vc (:fetcher github :repo stefanv/org-link-github)
  :commands (org-link-github-open org-link-github-export)
  :custom (org-link-github-shortcuts '(("skimage" . "scikit-image/scikit-image")
                                       ("numpy" . "numpy/numpy")))
  :init (org-link-set-parameters "gh"
          :follow #'org-link-github-open
          :export #'org-link-github-export))

Emacs <29

Either place org-link-github.el on your load-path, or add vc-use-package and follow the installation instructions above:

(unless (package-installed-p 'vc-use-package)
  (package-vc-install "https://github.com/slotThe/vc-use-package"))

Advanced usage

I also provide org-link-github-contract-url to convert GitHub URLs to the short org form. You can paste URLs to gh:... links as follows:

(defun stefanv/gh-paste ()
  (interactive)
  (insert
   (format "[[gh:%s]]"
           (string-trim (org-link-github-contract-url
                         (substring-no-properties
                          (gui-get-selection 'CLIPBOARD)))))))

With, e.g., a key binding:

(use-package org-link-github
    :commands (org-link-github-contract-url ...)

    ...

    :init
    (define-key org-mode-map (kbd "C-x C-g") 'stefanv/gh-paste))

About

Shorthand github links for org-mode

License:MIT License


Languages

Language:Emacs Lisp 100.0%