Must be enabled on a per-project basis. You can change this behavior by setting +magit-hub-enabled-by-default to non-nil (before magit is loaded). Magithub has been made opt-in because: 1. Magithub is imposing, asking the user for a token, especially for users who don't use github (much or at all), but may occasionally have a project with a github remote. 2. magithub is really slow on first load for medium-to-large repos. 3. It's really easy to enable it through the magithub popup (H C e). magithub.enabled is saved into the project's .git/config file, so the setting will persist. Also added a docstring to +magit-hub-features
65 lines
2.1 KiB
EmacsLisp
65 lines
2.1 KiB
EmacsLisp
;;; tools/magit/config.el -*- lexical-binding: t; -*-
|
|
|
|
(defvar +magit-hub-enable-by-default nil
|
|
"Whether or not to enable magithub features for all projects by default.")
|
|
|
|
(defvar +magit-hub-features
|
|
'(pull-request-merge commit-browse completion)
|
|
"What features to initialize when `magithub' is loaded. Set this to `t' to
|
|
load everything.")
|
|
|
|
|
|
;;
|
|
;; Plugins
|
|
;;
|
|
|
|
(def-package! magit
|
|
:defer t
|
|
:config
|
|
(setq magit-completing-read-function
|
|
(if (featurep! :completion ivy)
|
|
#'ivy-completing-read
|
|
#'magit-builtin-completing-read)
|
|
magit-revision-show-gravatars '("^Author: " . "^Commit: "))
|
|
|
|
(set! :popup "^\\(?:\\*magit\\|magit:\\)" :ignore)
|
|
;; no mode-line in magit popups
|
|
(add-hook 'magit-popup-mode-hook #'hide-mode-line-mode)
|
|
;; Clean up after magit by properly killing buffers
|
|
(map! :map magit-status-mode-map [remap magit-mode-bury-buffer] #'+magit/quit))
|
|
|
|
|
|
(def-package! magit-blame :after git-timemachine)
|
|
|
|
|
|
(def-package! magithub
|
|
:after magit
|
|
:preface
|
|
(setq magithub-dir (concat doom-etc-dir "magithub/"))
|
|
:init
|
|
(setq magithub-clone-default-directory "~/"
|
|
magithub-preferred-remote-method 'clone_url)
|
|
:config
|
|
(unless +magit-hub-enable-by-default
|
|
;; Disable magit by default. Can be enabled through magithub settings popup,
|
|
;; or setting `+magit-hub-enable-by-default'.
|
|
(advice-add #'magithub-enabled-p :override #'+magit*hub-enabled-p)
|
|
;; I don't use `magithub-settings--simple' to redefine this because it
|
|
;; changes the order of settings. Obnoxious, but the alternative is even
|
|
;; more so.
|
|
(advice-add #'magithub-settings--format-magithub.enabled
|
|
:override #'+magit*hub-settings--format-magithub.enabled))
|
|
(magithub-feature-autoinject +magit-hub-features))
|
|
|
|
|
|
(def-package! magit-gitflow
|
|
:hook (magit-mode . turn-on-magit-gitflow))
|
|
|
|
|
|
(def-package! evil-magit
|
|
:when (featurep! :feature evil +everywhere)
|
|
:after magit
|
|
:init (setq evil-magit-state 'normal)
|
|
:config
|
|
(map! :map (magit-mode-map magit-blame-read-only-mode-map)
|
|
doom-leader-key nil))
|