;;; git.el --- magit and stuff. -*- lexical-binding: t; -*- ;; Time-stamp: <2020-04-20T00:00:04+0200> ;;; Commentary: ;;; Code: (require 'basics/package-management) (require 'basics/global-variables) ;; Git integration. (use-package git-commit :defer 2) (unless slow-computer (use-package magit :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))) (purpose--action-function 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-c g" . magit-status) ("C-c M-g" . magit-dispatch) :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)) ) ) ; unless slow-computer. ;; Show VC status in fringe. (use-package git-gutter :bind ("C-c G" . git-gutter:popup-hunk) ; Popup current diff hunk. :hook ((prog-mode . git-gutter-mode) (text-mode . git-gutter-mode))) (provide 'programming/git) ;;; git.el ends here