79 lines
2.0 KiB
EmacsLisp
79 lines
2.0 KiB
EmacsLisp
|
;;; git.el --- magit and stuff. -*- lexical-binding: t; -*-
|
||
|
|
||
|
;; Time-stamp: <2020-01-27T02:06:44+0100>
|
||
|
|
||
|
;;; Commentary:
|
||
|
|
||
|
;;; Code:
|
||
|
|
||
|
(require 'basics/global-variables)
|
||
|
|
||
|
;; Git integration.
|
||
|
(use-package git-commit
|
||
|
:pin melpa
|
||
|
)
|
||
|
|
||
|
(unless slow-computer
|
||
|
;; magit from melpa needs transient from melpa.
|
||
|
(use-package transient
|
||
|
:pin melpa)
|
||
|
|
||
|
(use-package magit
|
||
|
:pin melpa
|
||
|
|
||
|
:custom
|
||
|
(magit-diff-refine-hunk 'all) ; Show word-granularity differences.
|
||
|
|
||
|
:config
|
||
|
(defun my/magit-display-buffer (buffer)
|
||
|
"Workaround to ensure that BUFFER is split vertically if necessary."
|
||
|
(if (and git-commit-mode
|
||
|
(with-current-buffer buffer
|
||
|
(derived-mode-p 'magit-diff-mode)))
|
||
|
(display-buffer buffer '((display-buffer-pop-up-window
|
||
|
display-buffer-use-some-window
|
||
|
display-buffer-below-selected)
|
||
|
(inhibit-same-window . t)))
|
||
|
(magit-display-buffer-traditional buffer)))
|
||
|
(setq magit-display-buffer-function #'my/magit-display-buffer)
|
||
|
|
||
|
:bind
|
||
|
("C-x g" . magit-status)
|
||
|
("C-x M-g" . magit-dispatch)
|
||
|
|
||
|
:hook
|
||
|
(after-save . magit-after-save-refresh-status)
|
||
|
)
|
||
|
|
||
|
;; Use libgit rather than git.
|
||
|
(use-package magit-libgit
|
||
|
:pin melpa
|
||
|
)
|
||
|
|
||
|
;; Show TODOs in magit-status.
|
||
|
(use-package magit-todos
|
||
|
:after magit
|
||
|
|
||
|
:config
|
||
|
;; Mark variables as safe. This prevents prompts when using .dir-locals.el.
|
||
|
(put 'magit-todos-depth 'safe-local-variable #'integerp)
|
||
|
|
||
|
:hook
|
||
|
(magit-mode . magit-todos-mode)
|
||
|
)
|
||
|
|
||
|
;; Work with Git forges from Magit.
|
||
|
(use-package forge
|
||
|
:pin melpa ; <https://github.com/magit/forge/issues/8>
|
||
|
|
||
|
:after magit
|
||
|
|
||
|
:config
|
||
|
(add-to-list 'forge-alist '("schlomp.space" "schlomp.space/api/v1"
|
||
|
"schlomp.space" forge-gitea-repository))
|
||
|
)
|
||
|
) ; unless slow-computer.
|
||
|
|
||
|
(provide 'programming/git)
|
||
|
;;; git.el ends here
|