Files
emacs/settings/version-control-settings.el
2025-07-01 15:11:27 +02:00

74 lines
2.6 KiB
EmacsLisp

;;; version-control-settings.el --- Version control settings -*- lexical-binding: t -*-
;;; Commentary:
;; IMPORTANT for magit: do not delete and change in magit-version.el
;; the version, see also git repo lisp/Makefile
;; TODO: add? https://github.com/alphapapa/magit-todos
;; Requirements:
;; magit https://melpa.org/#/magit
;; https://magit.vc/manual/magit/Installing-from-the-Git-Repository.html#Installing-from-the-Git-Repository
;; http://wikemacs.org/wiki/Magit
;; dash with-editor git-commit transient
;; git-messenger https://melpa.org/#/git-messenger
;; popup
;; orgit
;; diff-hl https://elpa.gnu.org/packages/diff-hl.html
;; (not anymore) ido-completing-read+ (now using ivy)
;; ivy
;;; Code:
;; see also Diff-Hl (diff-hl-mode) to see VC diff highlighting in fringes.
(use-package magit
:bind (("C-c M-g" . magit-file-dispatch))
:config
;; (setq magit-completing-read-function 'magit-builtin-completing-read) ;; if ivy-mode is on then it uses it otherwise set to 'ivy-completing-read
;; (setq magit-completing-read-function 'magit-ido-completing-read) ;; Use ido to checkout branches. requires ido-completing-read+
(defun my-magit-fringe-click (evt)
"Toggle section visibility in a magit mode buffer."
(interactive "e")
(mouse-set-point evt)
(magit-section-toggle (magit-current-section)))
(define-key magit-mode-map [left-fringe mouse-1] 'my-magit-fringe-click))
(use-package magit-section
:defer t)
;; On Windows, we must use Git GUI to enter username and password
;; See: https://github.com/magit/magit/wiki/FAQ#windows-cannot-push-via-https
(when (eq window-system 'w32)
(setenv "GIT_ASKPASS" "git-gui--askpass"))
(use-package git-messenger
:after (magit)
:bind (("C-x v p" . git-messenger:popup-message))
;;:config
;;(setq git-messenger:use-magit-popup t)
)
(use-package orgit
:after (magit org))
(use-package diff-hl
;; show diffs in fringes (for margins see `diff-hl-margin')
;; https://github.com/dgutov/diff-hl
:init (require 'diff-hl-autoloads)
:hook (((prog-mode vc-dir-mode org-mode) . turn-on-diff-hl-mode)
(magit-pre-refresh . diff-hl-magit-pre-refresh)
(magit-post-refresh . diff-hl-magit-post-refresh))
:commands (diff-hl-mode global-diff-hl-mode))
(use-package diff-hl-margin
;; There's no fringe when Emacs is running in the console, but the
;; navigation and revert commands still work. Consider turning
;; diff-hl-margin-mode on, to show the indicators in the margin
;; instead.
:unless (display-graphic-p)
:hook ((diff-hl-mode . diff-hl-margin-mode)))
(provide 'version-control-settings)
;;; version-control-settings.el ends here