.emacs.d/init.d/programming/git.el

62 lines
1.6 KiB
EmacsLisp

;;; git.el --- magit and stuff. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-06-23T02:21:39+0200>
;;; Commentary:
;;; Code:
(require 'basics/package-management)
(require 'basics/global-variables)
;; Git integration.
(use-package git-commit
:defer 2
:config (defun my/set-git-commit-fill-column ()
(setq-local fill-column 72))
:hook (git-commit-mode . my/set-git-commit-fill-column))
(unless slow-computer
(use-package magit
:custom
(magit-diff-refine-hunk 'all) ; Show word-granularity differences.
:bind
("C-x g" . nil) ; Disable default.
("C-c g" . magit-status)
("C-c M-g" . magit-dispatch)
(:map magit-hunk-section-map
("RET" . magit-diff-visit-worktree-file-other-window))
:hook
(after-save . magit-after-save-refresh-status)
)
;; Use libgit rather than git.
(use-package magit-libgit)
;; Show TODOs in magit-status.
(use-package magit-todos
:after magit
:init
;; 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
:after magit
:config (add-to-list 'forge-alist
'("schlomp.space" "schlomp.space/api/v1"
"schlomp.space" forge-gitea-repository))
:hook (prog-mode . forge-bug-reference-setup))
) ; unless slow-computer.
(provide 'programming/git)
;;; git.el ends here